All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] syscalls/ioctl_loop05.c: skip test on overlay filesystem
@ 2020-12-15 15:56 Radoslav Kolev
  2020-12-16  2:10 ` Yang Xu
  0 siblings, 1 reply; 7+ messages in thread
From: Radoslav Kolev @ 2020-12-15 15:56 UTC (permalink / raw)
  To: ltp

The undelrying device can't be properly detected and causes failure
when running in an overlay filesystem.

Signed-off-by: Radoslav Kolev <radoslav.kolev@suse.com>
---
 testcases/kernel/syscalls/ioctl/ioctl_loop05.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/testcases/kernel/syscalls/ioctl/ioctl_loop05.c b/testcases/kernel/syscalls/ioctl/ioctl_loop05.c
index e3c14faab..f8fa413a9 100644
--- a/testcases/kernel/syscalls/ioctl/ioctl_loop05.c
+++ b/testcases/kernel/syscalls/ioctl/ioctl_loop05.c
@@ -101,6 +101,9 @@ static void setup(void)
 	if (tst_fs_type(".") == TST_TMPFS_MAGIC)
 		tst_brk(TCONF, "tmpfd doesn't support O_DIRECT flag");
 
+	if (tst_fs_type(".") == TST_OVERLAYFS_MAGIC)
+		tst_brk(TCONF, "device isn't properly detected in overlay fs");
+
 	dev_num = tst_find_free_loopdev(dev_path, sizeof(dev_path));
 	if (dev_num < 0)
 		tst_brk(TBROK, "Failed to find free loop device");
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [LTP] [PATCH] syscalls/ioctl_loop05.c: skip test on overlay filesystem
  2020-12-15 15:56 [LTP] [PATCH] syscalls/ioctl_loop05.c: skip test on overlay filesystem Radoslav Kolev
@ 2020-12-16  2:10 ` Yang Xu
  2020-12-16  8:16   ` Radoslav Kolev
  0 siblings, 1 reply; 7+ messages in thread
From: Yang Xu @ 2020-12-16  2:10 UTC (permalink / raw)
  To: ltp

Hi Radoslav
> The undelrying device can't be properly detected and causes failure
> when running in an overlay filesystem.

I guess the best way is to change tst_find_backing_dev api, so it can 
detect the correct underlying device.

>
> Signed-off-by: Radoslav Kolev<radoslav.kolev@suse.com>
> ---
>   testcases/kernel/syscalls/ioctl/ioctl_loop05.c | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/testcases/kernel/syscalls/ioctl/ioctl_loop05.c b/testcases/kernel/syscalls/ioctl/ioctl_loop05.c
> index e3c14faab..f8fa413a9 100644
> --- a/testcases/kernel/syscalls/ioctl/ioctl_loop05.c
> +++ b/testcases/kernel/syscalls/ioctl/ioctl_loop05.c
> @@ -101,6 +101,9 @@ static void setup(void)
>   	if (tst_fs_type(".") == TST_TMPFS_MAGIC)
>   		tst_brk(TCONF, "tmpfd doesn't support O_DIRECT flag");
>
> +	if (tst_fs_type(".") == TST_OVERLAYFS_MAGIC)
> +		tst_brk(TCONF, "device isn't properly detected in overlay fs");
> +
>   	dev_num = tst_find_free_loopdev(dev_path, sizeof(dev_path));
>   	if (dev_num<  0)
>   		tst_brk(TBROK, "Failed to find free loop device");




^ permalink raw reply	[flat|nested] 7+ messages in thread

* [LTP] [PATCH] syscalls/ioctl_loop05.c: skip test on overlay filesystem
  2020-12-16  2:10 ` Yang Xu
@ 2020-12-16  8:16   ` Radoslav Kolev
  2020-12-16  8:30     ` Yang Xu
  0 siblings, 1 reply; 7+ messages in thread
From: Radoslav Kolev @ 2020-12-16  8:16 UTC (permalink / raw)
  To: ltp

On Wed, 2020-12-16 at 10:10 +0800, Yang Xu wrote:
> Hi Radoslav
> > The undelrying device can't be properly detected and causes failure
> > when running in an overlay filesystem.
> 
> I guess the best way is to change tst_find_backing_dev api, so it
> can 
> detect the correct underlying device.

Yes, that would be the best solution. If you have and idea of how to do
it that's not too complicated please give me some pointers.

I looked into it briefly, but didn't see a straighforward way.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [LTP] [PATCH] syscalls/ioctl_loop05.c: skip test on overlay filesystem
  2020-12-16  8:16   ` Radoslav Kolev
@ 2020-12-16  8:30     ` Yang Xu
  2021-01-05 15:24       ` Cyril Hrubis
  0 siblings, 1 reply; 7+ messages in thread
From: Yang Xu @ 2020-12-16  8:30 UTC (permalink / raw)
  To: ltp

Hi Radoslav
> On Wed, 2020-12-16 at 10:10 +0800, Yang Xu wrote:
>> Hi Radoslav
>>> The undelrying device can't be properly detected and causes failure
>>> when running in an overlay filesystem.
>>
>> I guess the best way is to change tst_find_backing_dev api, so it
>> can
>> detect the correct underlying device.
>
> Yes, that would be the best solution. If you have and idea of how to do
> it that's not too complicated please give me some pointers.
>
> I looked into it briefly, but didn't see a straighforward way.
>
The code maybe below(just check whether the device is a mountpotint, if 
it is, call tst_find_backing_dev api again)

diff --git a/lib/tst_device.c b/lib/tst_device.c
index c096b418b..de64fd908 100644
--- a/lib/tst_device.c
+++ b/lib/tst_device.c
@@ -534,6 +534,10 @@ void tst_find_backing_dev(const char *path, char *dev)
         if (stat(dev, &buf) < 0)
                 tst_brkm(TWARN | TERRNO, NULL, "stat(%s) failed", dev);

-       if (S_ISBLK(buf.st_mode) != 1)
-               tst_brkm(TCONF, NULL, "dev(%s) isn't a block dev", dev);
+       if (S_ISBLK(buf.st_mode) != 1) {
+               if (tst_is_mounted(dev))
+                       tst_find_backing_dev(dev, dev);
+               else
+                       tst_brkm(TCONF, NULL, "dev(%s) isn't a block 
dev", dev);
+       }
  }

My test environment is that
/dev/sda10              20G  623M   18G   4% /mnt/xfstests/test
/mnt/xfstests/test      20G  623M   18G   4% /mnt/xfstests/test/ovl-mnt
/dev/sda11              20G   46M   19G   1% /mnt/xfstests/scratch
/mnt/xfstests/scratch   20G   46M   19G   1% /mnt/xfstests/scratch/ovl-mnt

and my TMPDIR env is /mnt/xfstests/test/ovl-mnt.

>
>
> .
>




^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [LTP] [PATCH] syscalls/ioctl_loop05.c: skip test on overlay filesystem
  2020-12-16  8:30     ` Yang Xu
@ 2021-01-05 15:24       ` Cyril Hrubis
  2021-01-06  2:18         ` Yang Xu
  2021-01-12  2:12         ` Yang Xu
  0 siblings, 2 replies; 7+ messages in thread
From: Cyril Hrubis @ 2021-01-05 15:24 UTC (permalink / raw)
  To: ltp

Hi!
> diff --git a/lib/tst_device.c b/lib/tst_device.c
> index c096b418b..de64fd908 100644
> --- a/lib/tst_device.c
> +++ b/lib/tst_device.c
> @@ -534,6 +534,10 @@ void tst_find_backing_dev(const char *path, char *dev)
>          if (stat(dev, &buf) < 0)
>                  tst_brkm(TWARN | TERRNO, NULL, "stat(%s) failed", dev);
> 
> -       if (S_ISBLK(buf.st_mode) != 1)
> -               tst_brkm(TCONF, NULL, "dev(%s) isn't a block dev", dev);
> +       if (S_ISBLK(buf.st_mode) != 1) {
> +               if (tst_is_mounted(dev))
> +                       tst_find_backing_dev(dev, dev);
> +               else
> +                       tst_brkm(TCONF, NULL, "dev(%s) isn't a block 
> dev", dev);
> +       }
>   }
> 
> My test environment is that
> /dev/sda10              20G  623M   18G   4% /mnt/xfstests/test
> /mnt/xfstests/test      20G  623M   18G   4% /mnt/xfstests/test/ovl-mnt
> /dev/sda11              20G   46M   19G   1% /mnt/xfstests/scratch
> /mnt/xfstests/scratch   20G   46M   19G   1% /mnt/xfstests/scratch/ovl-mnt
> 
> and my TMPDIR env is /mnt/xfstests/test/ovl-mnt.

Does this code works for everyone or should we apply patch that disables
the test on overlay so that it's fixed for next release?

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [LTP] [PATCH] syscalls/ioctl_loop05.c: skip test on overlay filesystem
  2021-01-05 15:24       ` Cyril Hrubis
@ 2021-01-06  2:18         ` Yang Xu
  2021-01-12  2:12         ` Yang Xu
  1 sibling, 0 replies; 7+ messages in thread
From: Yang Xu @ 2021-01-06  2:18 UTC (permalink / raw)
  To: ltp

Hi Cyril
> Hi!
>> diff --git a/lib/tst_device.c b/lib/tst_device.c
>> index c096b418b..de64fd908 100644
>> --- a/lib/tst_device.c
>> +++ b/lib/tst_device.c
>> @@ -534,6 +534,10 @@ void tst_find_backing_dev(const char *path, char *dev)
>>           if (stat(dev,&buf)<  0)
>>                   tst_brkm(TWARN | TERRNO, NULL, "stat(%s) failed", dev);
>>
>> -       if (S_ISBLK(buf.st_mode) != 1)
>> -               tst_brkm(TCONF, NULL, "dev(%s) isn't a block dev", dev);
>> +       if (S_ISBLK(buf.st_mode) != 1) {
>> +               if (tst_is_mounted(dev))
>> +                       tst_find_backing_dev(dev, dev);
>> +               else
>> +                       tst_brkm(TCONF, NULL, "dev(%s) isn't a block
>> dev", dev);
>> +       }
>>    }
>>
>> My test environment is that
>> /dev/sda10              20G  623M   18G   4% /mnt/xfstests/test
>> /mnt/xfstests/test      20G  623M   18G   4% /mnt/xfstests/test/ovl-mnt
>> /dev/sda11              20G   46M   19G   1% /mnt/xfstests/scratch
>> /mnt/xfstests/scratch   20G   46M   19G   1% /mnt/xfstests/scratch/ovl-mnt
>>
>> and my TMPDIR env is /mnt/xfstests/test/ovl-mnt.
>
> Does this code works for everyone or should we apply patch that disables
> the test on overlay so that it's fixed for next release?
I guess it is ok for everyone, but I want to listen some advise from 
Amir since he is an expert about overlay filesystem.

Hi Amir
   Currently, Radoslav reported ltp tst_find_backing_dev api (we prase 
/proc/self/mountinfo and use " - " to delim string and get the bdev 
value after two fileds.) can not find really block dev when using 
overlay filesystem. It fails because this api doesn't consider user 
layer filesystem(like overlay). I think we should call 
tst_find_backing_dev_api again if this dev variable is not block dev and 
it is a mountpoint. I use the above environment and it is ok.
Wha do you think about it?

Best Regards
Yang Xu

>




^ permalink raw reply	[flat|nested] 7+ messages in thread

* [LTP] [PATCH] syscalls/ioctl_loop05.c: skip test on overlay filesystem
  2021-01-05 15:24       ` Cyril Hrubis
  2021-01-06  2:18         ` Yang Xu
@ 2021-01-12  2:12         ` Yang Xu
  1 sibling, 0 replies; 7+ messages in thread
From: Yang Xu @ 2021-01-12  2:12 UTC (permalink / raw)
  To: ltp

Hi Radoslav
> Hi!
>> diff --git a/lib/tst_device.c b/lib/tst_device.c
>> index c096b418b..de64fd908 100644
>> --- a/lib/tst_device.c
>> +++ b/lib/tst_device.c
>> @@ -534,6 +534,10 @@ void tst_find_backing_dev(const char *path, char *dev)
>>           if (stat(dev,&buf)<  0)
>>                   tst_brkm(TWARN | TERRNO, NULL, "stat(%s) failed", dev);
>>
>> -       if (S_ISBLK(buf.st_mode) != 1)
>> -               tst_brkm(TCONF, NULL, "dev(%s) isn't a block dev", dev);
>> +       if (S_ISBLK(buf.st_mode) != 1) {
>> +               if (tst_is_mounted(dev))
>> +                       tst_find_backing_dev(dev, dev);
>> +               else
>> +                       tst_brkm(TCONF, NULL, "dev(%s) isn't a block
>> dev", dev);
>> +       }
>>    }
>>
>> My test environment is that
>> /dev/sda10              20G  623M   18G   4% /mnt/xfstests/test
>> /mnt/xfstests/test      20G  623M   18G   4% /mnt/xfstests/test/ovl-mnt
>> /dev/sda11              20G   46M   19G   1% /mnt/xfstests/scratch
>> /mnt/xfstests/scratch   20G   46M   19G   1% /mnt/xfstests/scratch/ovl-mnt
>>
>> and my TMPDIR env is /mnt/xfstests/test/ovl-mnt.
>
> Does this code works for everyone or should we apply patch that disables
> the test on overlay so that it's fixed for next release?
Thanks for this patch, merged.

Best Regards
Yang Xu
>




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-01-12  2:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-15 15:56 [LTP] [PATCH] syscalls/ioctl_loop05.c: skip test on overlay filesystem Radoslav Kolev
2020-12-16  2:10 ` Yang Xu
2020-12-16  8:16   ` Radoslav Kolev
2020-12-16  8:30     ` Yang Xu
2021-01-05 15:24       ` Cyril Hrubis
2021-01-06  2:18         ` Yang Xu
2021-01-12  2:12         ` Yang Xu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.