diff mbox series

syscalls/swapon02: Do not fail on overlayfs

Message ID 20190430071446.13716-1-xzhou@redhat.com
State Changes Requested
Delegated to: Petr Vorel
Headers show
Series syscalls/swapon02: Do not fail on overlayfs | expand

Commit Message

Murphy Zhou April 30, 2019, 7:14 a.m. UTC
Currently swapfiles on Overlayfs are not supported.

So if we are on overlayfs and we get EINVAL from swapon() we return TCONF.

Signed-off-by: Murphy Zhou <xzhou@redhat.com>
---
 testcases/kernel/syscalls/swapon/swapon02.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Li Wang April 30, 2019, 8:14 a.m. UTC | #1
On Tue, Apr 30, 2019 at 3:21 PM Murphy Zhou <xzhou@redhat.com> wrote:

> Currently swapfiles on Overlayfs are not supported.
>
> So if we are on overlayfs and we get EINVAL from swapon() we return TCONF.
>
> Signed-off-by: Murphy Zhou <xzhou@redhat.com>
> ---
>  testcases/kernel/syscalls/swapon/swapon02.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/testcases/kernel/syscalls/swapon/swapon02.c
> b/testcases/kernel/syscalls/swapon/swapon02.c
> index 4af5105c6..211cdfc4e 100644
> --- a/testcases/kernel/syscalls/swapon/swapon02.c
> +++ b/testcases/kernel/syscalls/swapon/swapon02.c
> @@ -86,6 +86,11 @@ static void verify_swapon(struct test_case_t *test)
>                         return;
>         }
>
> +       if (fs_type == TST_OVERLAYFS_MAGIC && errno == EINVAL) {
> +               tst_resm(TCONF, "Swapfile on overlayfs not implemeted");
> +                       return;
> +       }
>

The code looks correct.

But it already has a test skipping for BTRFS, is there any possibility to
combine these filesystems check together?


> +
>         tst_resm(TFAIL, "swapon(2) failed to produce expected error:"
>                  " %d, errno: %s and got %d.", test->exp_errno,
>                  test->exp_errval, TEST_ERRNO);
> --
> 2.21.0
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
>
Murphy Zhou April 30, 2019, 8:30 a.m. UTC | #2
On Tue, Apr 30, 2019 at 04:14:23PM +0800, Li Wang wrote:
> On Tue, Apr 30, 2019 at 3:21 PM Murphy Zhou <xzhou@redhat.com> wrote:
> 
> > Currently swapfiles on Overlayfs are not supported.
> >
> > So if we are on overlayfs and we get EINVAL from swapon() we return TCONF.
> >
> > Signed-off-by: Murphy Zhou <xzhou@redhat.com>
> > ---
> >  testcases/kernel/syscalls/swapon/swapon02.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/testcases/kernel/syscalls/swapon/swapon02.c
> > b/testcases/kernel/syscalls/swapon/swapon02.c
> > index 4af5105c6..211cdfc4e 100644
> > --- a/testcases/kernel/syscalls/swapon/swapon02.c
> > +++ b/testcases/kernel/syscalls/swapon/swapon02.c
> > @@ -86,6 +86,11 @@ static void verify_swapon(struct test_case_t *test)
> >                         return;
> >         }
> >
> > +       if (fs_type == TST_OVERLAYFS_MAGIC && errno == EINVAL) {
> > +               tst_resm(TCONF, "Swapfile on overlayfs not implemeted");
> > +                       return;
> > +       }
> >
> 
> The code looks correct.
> 
> But it already has a test skipping for BTRFS, is there any possibility to
> combine these filesystems check together?

Good idea~  Sending V2.

Thansk!
M

> 
> 
> > +
> >         tst_resm(TFAIL, "swapon(2) failed to produce expected error:"
> >                  " %d, errno: %s and got %d.", test->exp_errno,
> >                  test->exp_errval, TEST_ERRNO);
> > --
> > 2.21.0
> >
> >
> > --
> > Mailing list info: https://lists.linux.it/listinfo/ltp
> >
> 
> 
> -- 
> Regards,
> Li Wang
Li Wang April 30, 2019, 8:54 a.m. UTC | #3
On Tue, Apr 30, 2019 at 4:31 PM Murphy Zhou <xzhou@redhat.com> wrote:

> On Tue, Apr 30, 2019 at 04:14:23PM +0800, Li Wang wrote:
> > On Tue, Apr 30, 2019 at 3:21 PM Murphy Zhou <xzhou@redhat.com> wrote:
> >
> > > Currently swapfiles on Overlayfs are not supported.
> > >
> > > So if we are on overlayfs and we get EINVAL from swapon() we return
> TCONF.
> > >
> > > Signed-off-by: Murphy Zhou <xzhou@redhat.com>
> > > ---
> > >  testcases/kernel/syscalls/swapon/swapon02.c | 5 +++++
> > >  1 file changed, 5 insertions(+)
> > >
> > > diff --git a/testcases/kernel/syscalls/swapon/swapon02.c
> > > b/testcases/kernel/syscalls/swapon/swapon02.c
> > > index 4af5105c6..211cdfc4e 100644
> > > --- a/testcases/kernel/syscalls/swapon/swapon02.c
> > > +++ b/testcases/kernel/syscalls/swapon/swapon02.c
> > > @@ -86,6 +86,11 @@ static void verify_swapon(struct test_case_t *test)
> > >                         return;
> > >         }
> > >
> > > +       if (fs_type == TST_OVERLAYFS_MAGIC && errno == EINVAL) {
> > > +               tst_resm(TCONF, "Swapfile on overlayfs not
> implemeted");
> > > +                       return;
> > > +       }
> > >
> >
> > The code looks correct.
> >
> > But it already has a test skipping for BTRFS, is there any possibility to
> > combine these filesystems check together?
>
> Good idea~  Sending V2.
>

One more comment.

I just noticed that it also has an FS skipping list in setup(), do u think
can we move BTRFS and OVERLAYFS to there?
Murphy Zhou April 30, 2019, 9:08 a.m. UTC | #4
On Tue, Apr 30, 2019 at 04:54:23PM +0800, Li Wang wrote:
> On Tue, Apr 30, 2019 at 4:31 PM Murphy Zhou <xzhou@redhat.com> wrote:
> 
> > On Tue, Apr 30, 2019 at 04:14:23PM +0800, Li Wang wrote:
> > > On Tue, Apr 30, 2019 at 3:21 PM Murphy Zhou <xzhou@redhat.com> wrote:
> > >
> > > > Currently swapfiles on Overlayfs are not supported.
> > > >
> > > > So if we are on overlayfs and we get EINVAL from swapon() we return
> > TCONF.
> > > >
> > > > Signed-off-by: Murphy Zhou <xzhou@redhat.com>
> > > > ---
> > > >  testcases/kernel/syscalls/swapon/swapon02.c | 5 +++++
> > > >  1 file changed, 5 insertions(+)
> > > >
> > > > diff --git a/testcases/kernel/syscalls/swapon/swapon02.c
> > > > b/testcases/kernel/syscalls/swapon/swapon02.c
> > > > index 4af5105c6..211cdfc4e 100644
> > > > --- a/testcases/kernel/syscalls/swapon/swapon02.c
> > > > +++ b/testcases/kernel/syscalls/swapon/swapon02.c
> > > > @@ -86,6 +86,11 @@ static void verify_swapon(struct test_case_t *test)
> > > >                         return;
> > > >         }
> > > >
> > > > +       if (fs_type == TST_OVERLAYFS_MAGIC && errno == EINVAL) {
> > > > +               tst_resm(TCONF, "Swapfile on overlayfs not
> > implemeted");
> > > > +                       return;
> > > > +       }
> > > >
> > >
> > > The code looks correct.
> > >
> > > But it already has a test skipping for BTRFS, is there any possibility to
> > > combine these filesystems check together?
> >
> > Good idea~  Sending V2.
> >
> 
> One more comment.
> 
> I just noticed that it also has an FS skipping list in setup(), do u think
> can we move BTRFS and OVERLAYFS to there?

Great! That makes perfect sense. Also I'm thinking a few other tweaks
needed:

  NFS now actually support swapfiles. Let's remove it from skip list;
  Skip all swapon/swapoff tests on TMPFS BTRFS OVERLAYFS;
  Add CIFS_MAGIC, then skip on it too;
  Remove existing BTRFS return value tweaks.

Thanks,
M

> 
> -- 
> Regards,
> Li Wang
Li Wang April 30, 2019, 9:21 a.m. UTC | #5
On Tue, Apr 30, 2019 at 5:08 PM Murphy Zhou <xzhou@redhat.com> wrote:

> ...
> > > > > +       if (fs_type == TST_OVERLAYFS_MAGIC && errno == EINVAL) {
> > > > > +               tst_resm(TCONF, "Swapfile on overlayfs not
> > > implemeted");
> > > > > +                       return;
> > > > > +       }
> > > > >
> > > >
> > > > The code looks correct.
> > > >
> > > > But it already has a test skipping for BTRFS, is there any
> possibility to
> > > > combine these filesystems check together?
> > >
> > > Good idea~  Sending V2.
> > >
> >
> > One more comment.
> >
> > I just noticed that it also has an FS skipping list in setup(), do u
> think
> > can we move BTRFS and OVERLAYFS to there?
>
> Great! That makes perfect sense. Also I'm thinking a few other tweaks
> needed:
>
>   NFS now actually support swapfiles. Let's remove it from skip list;
>

But AFAIK someone still run LTP on old distro/kernel, so we can't guarantee
the test works fine in that situation. So, my opinion is to reserve the
NFS, or do you have a better way to make test more flexible?


>   Skip all swapon/swapoff tests on TMPFS BTRFS OVERLAYFS;
>   Add CIFS_MAGIC, then skip on it too;
>   Remove existing BTRFS return value tweaks.
>

Agree.
Murphy Zhou April 30, 2019, 9:29 a.m. UTC | #6
On Tue, Apr 30, 2019 at 05:21:34PM +0800, Li Wang wrote:
> On Tue, Apr 30, 2019 at 5:08 PM Murphy Zhou <xzhou@redhat.com> wrote:
> 
> > ...
> > > > > > +       if (fs_type == TST_OVERLAYFS_MAGIC && errno == EINVAL) {
> > > > > > +               tst_resm(TCONF, "Swapfile on overlayfs not
> > > > implemeted");
> > > > > > +                       return;
> > > > > > +       }
> > > > > >
> > > > >
> > > > > The code looks correct.
> > > > >
> > > > > But it already has a test skipping for BTRFS, is there any
> > possibility to
> > > > > combine these filesystems check together?
> > > >
> > > > Good idea~  Sending V2.
> > > >
> > >
> > > One more comment.
> > >
> > > I just noticed that it also has an FS skipping list in setup(), do u
> > think
> > > can we move BTRFS and OVERLAYFS to there?
> >
> > Great! That makes perfect sense. Also I'm thinking a few other tweaks
> > needed:
> >
> >   NFS now actually support swapfiles. Let's remove it from skip list;
> >
> 
> But AFAIK someone still run LTP on old distro/kernel, so we can't guarantee
> the test works fine in that situation. So, my opinion is to reserve the
> NFS, or do you have a better way to make test more flexible?

Fair enough. We can reserve NFS on the skip list to avoid much false alarms.
> 
> 
> >   Skip all swapon/swapoff tests on TMPFS BTRFS OVERLAYFS;
> >   Add CIFS_MAGIC, then skip on it too;
> >   Remove existing BTRFS return value tweaks.
> >
> 
> Agree.

Thanks!

M
> 
> -- 
> Regards,
> Li Wang
Amir Goldstein April 30, 2019, 9:37 a.m. UTC | #7
On Tue, Apr 30, 2019 at 5:21 AM Li Wang <liwang@redhat.com> wrote:
>
>
>
> On Tue, Apr 30, 2019 at 5:08 PM Murphy Zhou <xzhou@redhat.com> wrote:
>>
>> ...
>> > > > > +       if (fs_type == TST_OVERLAYFS_MAGIC && errno == EINVAL) {
>> > > > > +               tst_resm(TCONF, "Swapfile on overlayfs not
>> > > implemeted");
>> > > > > +                       return;
>> > > > > +       }
>> > > > >
>> > > >
>> > > > The code looks correct.
>> > > >
>> > > > But it already has a test skipping for BTRFS, is there any possibility to
>> > > > combine these filesystems check together?
>> > >
>> > > Good idea~  Sending V2.
>> > >
>> >
>> > One more comment.
>> >
>> > I just noticed that it also has an FS skipping list in setup(), do u think
>> > can we move BTRFS and OVERLAYFS to there?
>>
>> Great! That makes perfect sense. Also I'm thinking a few other tweaks
>> needed:
>>
>>   NFS now actually support swapfiles. Let's remove it from skip list;
>
>
> But AFAIK someone still run LTP on old distro/kernel, so we can't guarantee the test works fine in that situation. So, my opinion is to reserve the NFS, or do you have a better way to make test more flexible?

Avoid whitelist.
Test for FIBMAP ioctl support.

Thanks,
Amir.
Murphy Zhou April 30, 2019, 9:54 a.m. UTC | #8
On Tue, Apr 30, 2019 at 05:37:36AM -0400, Amir Goldstein wrote:
> On Tue, Apr 30, 2019 at 5:21 AM Li Wang <liwang@redhat.com> wrote:
> >
> >
> >
> > On Tue, Apr 30, 2019 at 5:08 PM Murphy Zhou <xzhou@redhat.com> wrote:
> >>
> >> ...
> >> > > > > +       if (fs_type == TST_OVERLAYFS_MAGIC && errno == EINVAL) {
> >> > > > > +               tst_resm(TCONF, "Swapfile on overlayfs not
> >> > > implemeted");
> >> > > > > +                       return;
> >> > > > > +       }
> >> > > > >
> >> > > >
> >> > > > The code looks correct.
> >> > > >
> >> > > > But it already has a test skipping for BTRFS, is there any possibility to
> >> > > > combine these filesystems check together?
> >> > >
> >> > > Good idea~  Sending V2.
> >> > >
> >> >
> >> > One more comment.
> >> >
> >> > I just noticed that it also has an FS skipping list in setup(), do u think
> >> > can we move BTRFS and OVERLAYFS to there?
> >>
> >> Great! That makes perfect sense. Also I'm thinking a few other tweaks
> >> needed:
> >>
> >>   NFS now actually support swapfiles. Let's remove it from skip list;
> >
> >
> > But AFAIK someone still run LTP on old distro/kernel, so we can't guarantee the test works fine in that situation. So, my opinion is to reserve the NFS, or do you have a better way to make test more flexible?
> 
> Avoid whitelist.
> Test for FIBMAP ioctl support.

Hmm.. This is better. I'll try.

Thanks!
M

> 
> Thanks,
> Amir.
diff mbox series

Patch

diff --git a/testcases/kernel/syscalls/swapon/swapon02.c b/testcases/kernel/syscalls/swapon/swapon02.c
index 4af5105c6..211cdfc4e 100644
--- a/testcases/kernel/syscalls/swapon/swapon02.c
+++ b/testcases/kernel/syscalls/swapon/swapon02.c
@@ -86,6 +86,11 @@  static void verify_swapon(struct test_case_t *test)
 			return;
 	}
 
+	if (fs_type == TST_OVERLAYFS_MAGIC && errno == EINVAL) {
+		tst_resm(TCONF, "Swapfile on overlayfs not implemeted");
+			return;
+	}
+
 	tst_resm(TFAIL, "swapon(2) failed to produce expected error:"
 	         " %d, errno: %s and got %d.", test->exp_errno,
 	         test->exp_errval, TEST_ERRNO);