diff mbox series

[2/2] swapon03: Swap is not supported on TMPFS on tmpfs

Message ID 20240205022857.191692-2-pvorel@suse.cz
State Superseded
Headers show
Series [1/2] swapon03: Cleanup | expand

Commit Message

Petr Vorel Feb. 5, 2024, 2:28 a.m. UTC
tst_test.c:1701: TINFO: === Testing on ext4 ===
tst_test.c:1117: TINFO: Formatting /dev/loop0 with ext4 opts='' extra opts=''
mke2fs 1.47.0 (5-Feb-2023)
tst_test.c:1131: TINFO: Mounting /dev/loop0 to /tmp/LTP_swanIztq7/mntpoint fstyp=ext4 flags=0
tst_ioctl.c:26: TINFO: FIBMAP ioctl is supported
swapon03.c:164: TWARN: Failed to create swapfile: swapfile02: EINVAL (22)
swapon03.c:175: TFAIL: Failed to setup swaps

At least on kernel 6.7.

Fixes: 009a407a0 ("swapon/off: enable all_filesystem in swap test")
Reported-by: Dominique Leuenberger <dimstar@opensuse.org>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/kernel/syscalls/swapon/swapon03.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Li Wang Feb. 5, 2024, 7:48 a.m. UTC | #1
On Mon, Feb 5, 2024 at 10:29 AM Petr Vorel <pvorel@suse.cz> wrote:

> tst_test.c:1701: TINFO: === Testing on ext4 ===
> tst_test.c:1117: TINFO: Formatting /dev/loop0 with ext4 opts='' extra
> opts=''
> mke2fs 1.47.0 (5-Feb-2023)
> tst_test.c:1131: TINFO: Mounting /dev/loop0 to /tmp/LTP_swanIztq7/mntpoint
> fstyp=ext4 flags=0
> tst_ioctl.c:26: TINFO: FIBMAP ioctl is supported
> swapon03.c:164: TWARN: Failed to create swapfile: swapfile02: EINVAL (22)
> swapon03.c:175: TFAIL: Failed to setup swaps
>
> At least on kernel 6.7.
>
> Fixes: 009a407a0 ("swapon/off: enable all_filesystem in swap test")
> Reported-by: Dominique Leuenberger <dimstar@opensuse.org>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
>  testcases/kernel/syscalls/swapon/swapon03.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/testcases/kernel/syscalls/swapon/swapon03.c
> b/testcases/kernel/syscalls/swapon/swapon03.c
> index 3dbcd5bfd..37314cc65 100644
> --- a/testcases/kernel/syscalls/swapon/swapon03.c
> +++ b/testcases/kernel/syscalls/swapon/swapon03.c
> @@ -247,6 +247,9 @@ static void setup(void)
>         if (access("/proc/swaps", F_OK))
>                 tst_brk(TCONF, "swap not supported by kernel");
>
> +       if (tst_fs_type(".") == TST_TMPFS_MAGIC)
> +               tst_brk(TCONF, "swap not supported on tmpfs");
>

I didn't catch the patch point, isn't the failure on EXT4, why here skip
tmpfs?
And, shouldn't the FS check completed in is_swap_supported()?



> +
>         is_swap_supported(TEST_FILE);
>  }
>
> --
> 2.43.0
>
>
Petr Vorel Feb. 5, 2024, 11 a.m. UTC | #2
> On Mon, Feb 5, 2024 at 10:29 AM Petr Vorel <pvorel@suse.cz> wrote:

> > tst_test.c:1701: TINFO: === Testing on ext4 ===
> > tst_test.c:1117: TINFO: Formatting /dev/loop0 with ext4 opts='' extra
> > opts=''
> > mke2fs 1.47.0 (5-Feb-2023)
> > tst_test.c:1131: TINFO: Mounting /dev/loop0 to /tmp/LTP_swanIztq7/mntpoint
> > fstyp=ext4 flags=0
> > tst_ioctl.c:26: TINFO: FIBMAP ioctl is supported
> > swapon03.c:164: TWARN: Failed to create swapfile: swapfile02: EINVAL (22)
> > swapon03.c:175: TFAIL: Failed to setup swaps

> > At least on kernel 6.7.

> > Fixes: 009a407a0 ("swapon/off: enable all_filesystem in swap test")
> > Reported-by: Dominique Leuenberger <dimstar@opensuse.org>
> > Signed-off-by: Petr Vorel <pvorel@suse.cz>
> > ---
> >  testcases/kernel/syscalls/swapon/swapon03.c | 3 +++
> >  1 file changed, 3 insertions(+)

> > diff --git a/testcases/kernel/syscalls/swapon/swapon03.c
> > b/testcases/kernel/syscalls/swapon/swapon03.c
> > index 3dbcd5bfd..37314cc65 100644
> > --- a/testcases/kernel/syscalls/swapon/swapon03.c
> > +++ b/testcases/kernel/syscalls/swapon/swapon03.c
> > @@ -247,6 +247,9 @@ static void setup(void)
> >         if (access("/proc/swaps", F_OK))
> >                 tst_brk(TCONF, "swap not supported by kernel");

> > +       if (tst_fs_type(".") == TST_TMPFS_MAGIC)
> > +               tst_brk(TCONF, "swap not supported on tmpfs");

[ Cc Yang Xu, because he posted a patchset about MAX_SWAPFILES [1], maybe that
would fix the problem ]

> I didn't catch the patch point, isn't the failure on EXT4, why here skip
> tmpfs?
> And, shouldn't the FS check completed in is_swap_supported()?

I'm sorry, the problem is with TMPDIR on tmpfs (which is on Tumbleweed).

Tested on 6.8.0-rc1-2.gf4ba5db-default and 6.7 stable. Or is it a bug in
FIBMAP ioctl detection?

Kind regards,
Petr

[1] https://patchwork.ozlabs.org/project/ltp/list/?series=387814&state=*

> > +
> >         is_swap_supported(TEST_FILE);
> >  }

> > --
> > 2.43.0
Petr Vorel Feb. 12, 2024, 7:30 p.m. UTC | #3
Hi Li, Yang Xu,

this is invalid, replaced by:

https://lore.kernel.org/ltp/20240212192612.636901-1-pvorel@suse.cz/
https://patchwork.ozlabs.org/project/ltp/patch/20240212192612.636901-1-pvorel@suse.cz/

Could we please merge this simple fix before Yang Xu cleanup patchset:

https://patchwork.ozlabs.org/project/ltp/list/?series=394113
https://lore.kernel.org/ltp/20240208100517.1974-1-xuyang2018.jy@fujitsu.com/

I'm sorry, that would mean to send rebased version, but IMHO better include
simple fix.

Kind regards,
Petr
Yang Xu Feb. 19, 2024, 10:49 a.m. UTC | #4
Hi Petr, Li

> Hi Li, Yang Xu,
> 
> this is invalid, replaced by:
> 
> https://lore.kernel.org/ltp/20240212192612.636901-1-pvorel@suse.cz/
> https://patchwork.ozlabs.org/project/ltp/patch/20240212192612.636901-1-pvorel@suse.cz/
> 
> Could we please merge this simple fix before Yang Xu cleanup patchset:
> 
> https://patchwork.ozlabs.org/project/ltp/list/?series=394113
> https://lore.kernel.org/ltp/20240208100517.1974-1-xuyang2018.jy@fujitsu.com/
> 
> I'm sorry, that would mean to send rebased version, but IMHO better include
> simple fix.
> 

Now, can I send v4 patchset for maxswapfiles since Li's patch (fix 
snprintf return value problem) has been merged int master?

Best Regards
Yang Xu
> Kind regards,
> Petr
Petr Vorel Feb. 19, 2024, 3:21 p.m. UTC | #5
> Hi Petr, Li

> > Hi Li, Yang Xu,

> > this is invalid, replaced by:

> > https://lore.kernel.org/ltp/20240212192612.636901-1-pvorel@suse.cz/
> > https://patchwork.ozlabs.org/project/ltp/patch/20240212192612.636901-1-pvorel@suse.cz/

> > Could we please merge this simple fix before Yang Xu cleanup patchset:

> > https://patchwork.ozlabs.org/project/ltp/list/?series=394113
> > https://lore.kernel.org/ltp/20240208100517.1974-1-xuyang2018.jy@fujitsu.com/

> > I'm sorry, that would mean to send rebased version, but IMHO better include
> > simple fix.


> Now, can I send v4 patchset for maxswapfiles since Li's patch (fix 
> snprintf return value problem) has been merged int master?

Yes, please.

Kind regards,
Petr

> Best Regards
> Yang Xu
> > Kind regards,
> > Petr
diff mbox series

Patch

diff --git a/testcases/kernel/syscalls/swapon/swapon03.c b/testcases/kernel/syscalls/swapon/swapon03.c
index 3dbcd5bfd..37314cc65 100644
--- a/testcases/kernel/syscalls/swapon/swapon03.c
+++ b/testcases/kernel/syscalls/swapon/swapon03.c
@@ -247,6 +247,9 @@  static void setup(void)
 	if (access("/proc/swaps", F_OK))
 		tst_brk(TCONF, "swap not supported by kernel");
 
+	if (tst_fs_type(".") == TST_TMPFS_MAGIC)
+		tst_brk(TCONF, "swap not supported on tmpfs");
+
 	is_swap_supported(TEST_FILE);
 }