diff mbox series

overlay/071: Fix undefined OVL_BASE_SCRATCH_DIR

Message ID 20200930050409.24705-1-yangx.jy@cn.fujitsu.com (mailing list archive)
State New, archived
Headers show
Series overlay/071: Fix undefined OVL_BASE_SCRATCH_DIR | expand

Commit Message

Xiao Yang Sept. 30, 2020, 5:04 a.m. UTC
Replace undefined OVL_BASE_SCRATCH_DIR with OVL_BASE_SCRATCH_MNT

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 tests/overlay/071 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Xiao Yang Sept. 30, 2020, 5:32 a.m. UTC | #1
Hi Amir,

I always got diffenent inode number if underlying fileystem is ext4.
------------------------------------------------
# diff -u /var/lib/xfstests/tests/overlay/071.out
/var/lib/xfstests/results//overlay/071.out.bad
--- /var/lib/xfstests/tests/overlay/071.out 2020-09-30
12:59:30.478968816 +0800
+++ /var/lib/xfstests/results//overlay/071.out.bad 2020-09-30
13:13:02.342920819 +0800
@@ -1,2 +1,26 @@
QA output created by 071
+--- /tmp/25096.lower.lo 2020-09-30 13:12:59.594920981 +0800
++++ /tmp/25096.before.lo 2020-09-30 13:12:59.706920975 +0800
+@@ -1,7 +1,7 @@
+-8590721028 file
+-8590721029 symlink
+-8590721030 link
+-8590721031 chrdev
+-8590721032 blkdev
+-8590721033 fifo
+-8590721034 socket
++9223372045445496836 file
++9223372045445496837 symlink
++9223372045445496838 link
++9223372045445496839 chrdev
++9223372045445496840 blkdev
++9223372045445496841 fifo
++9223372045445496842 socket
+file not found by ino 8590721028 (from /tmp/25096.lower.lo) - see
/var/lib/xfstests/results//overlay/071.full
+symlink not found by ino 8590721029 (from /tmp/25096.lower.lo) - see
/var/lib/xfstests/results//overlay/071.full
+link not found by ino 8590721030 (from /tmp/25096.lower.lo) - see
/var/lib/xfstests/results//overlay/071.full
+chrdev not found by ino 8590721031 (from /tmp/25096.lower.lo) - see
/var/lib/xfstests/results//overlay/071.full
+blkdev not found by ino 8590721032 (from /tmp/25096.lower.lo) - see
/var/lib/xfstests/results//overlay/071.full
+fifo not found by ino 8590721033 (from /tmp/25096.lower.lo) - see
/var/lib/xfstests/results//overlay/071.full
+socket not found by ino 8590721034 (from /tmp/25096.lower.lo) - see
/var/lib/xfstests/results//overlay/071.full
Silence is golde
------------------------------------------------
Is this expected behavior? :-)

Best Regards,
Xiao Yang
On 2020/9/30 13:04, Xiao Yang wrote:
> Replace undefined OVL_BASE_SCRATCH_DIR with OVL_BASE_SCRATCH_MNT
>
> Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
> ---
>  tests/overlay/071 | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/tests/overlay/071 b/tests/overlay/071
> index f18429c9..ac2324c8 100755
> --- a/tests/overlay/071
> +++ b/tests/overlay/071
> @@ -59,9 +59,9 @@ lower=$OVL_BASE_TEST_DIR/$OVL_LOWER-$seq
>  upper=$OVL_BASE_SCRATCH_MNT/$OVL_UPPER
>  work=$OVL_BASE_SCRATCH_MNT/$OVL_WORK
>  # Lower dir of nested overlay is the scratch overlay mount at SCRATCH_MNT
> -upper2=$OVL_BASE_SCRATCH_DIR/$OVL_UPPER.2
> -work2=$OVL_BASE_SCRATCH_DIR/$OVL_WORK.2
> -mnt2=$OVL_BASE_SCRATCH_DIR/$OVL_MNT.2
> +upper2=$OVL_BASE_SCRATCH_MNT/$OVL_UPPER.2
> +work2=$OVL_BASE_SCRATCH_MNT/$OVL_WORK.2
> +mnt2=$OVL_BASE_SCRATCH_MNT/$OVL_MNT.2
>  
>  lowerdir=$lower/lowertestdir
>  upperdir=$upper/uppertestdir
Amir Goldstein Sept. 30, 2020, 7:54 a.m. UTC | #2
On Wed, Sep 30, 2020 at 8:33 AM Xiao Yang <yangx.jy@cn.fujitsu.com> wrote:
>
> Hi Amir,
>
> I always got diffenent inode number if underlying fileystem is ext4.
> ------------------------------------------------
> # diff -u /var/lib/xfstests/tests/overlay/071.out
> /var/lib/xfstests/results//overlay/071.out.bad
> --- /var/lib/xfstests/tests/overlay/071.out 2020-09-30
> 12:59:30.478968816 +0800
> +++ /var/lib/xfstests/results//overlay/071.out.bad 2020-09-30
> 13:13:02.342920819 +0800
> @@ -1,2 +1,26 @@
> QA output created by 071
> +--- /tmp/25096.lower.lo 2020-09-30 13:12:59.594920981 +0800
> ++++ /tmp/25096.before.lo 2020-09-30 13:12:59.706920975 +0800
> +@@ -1,7 +1,7 @@
> +-8590721028 file
> +-8590721029 symlink
> +-8590721030 link
> +-8590721031 chrdev
> +-8590721032 blkdev
> +-8590721033 fifo
> +-8590721034 socket
> ++9223372045445496836 file
> ++9223372045445496837 symlink
> ++9223372045445496838 link
> ++9223372045445496839 chrdev
> ++9223372045445496840 blkdev
> ++9223372045445496841 fifo
> ++9223372045445496842 socket
> +file not found by ino 8590721028 (from /tmp/25096.lower.lo) - see
> /var/lib/xfstests/results//overlay/071.full
> +symlink not found by ino 8590721029 (from /tmp/25096.lower.lo) - see
> /var/lib/xfstests/results//overlay/071.full
> +link not found by ino 8590721030 (from /tmp/25096.lower.lo) - see
> /var/lib/xfstests/results//overlay/071.full
> +chrdev not found by ino 8590721031 (from /tmp/25096.lower.lo) - see
> /var/lib/xfstests/results//overlay/071.full
> +blkdev not found by ino 8590721032 (from /tmp/25096.lower.lo) - see
> /var/lib/xfstests/results//overlay/071.full
> +fifo not found by ino 8590721033 (from /tmp/25096.lower.lo) - see
> /var/lib/xfstests/results//overlay/071.full
> +socket not found by ino 8590721034 (from /tmp/25096.lower.lo) - see
> /var/lib/xfstests/results//overlay/071.full
> Silence is golde
> ------------------------------------------------
> Is this expected behavior? :-)

Yes and No :-)

The result is expected. It is not expected for the test to fail.
This is a test bug.

The bug is in this line and in the comment above it:
# Compare inode numbers in lower overlay vs. nested overlay
# With nested xino lower/lower, all inode numbers overflow xino bits and
# d_ino/i_ino in nested overlay are the same as in lower overlay.
check_inode_numbers $lowertestdir $tmp.lower.lo $tmp.before.lo

This test is meant to cover the case of "xino=on/auto, ino overflow" from:
https://github.com/torvalds/linux/blob/master/Documentation/filesystems/overlayfs.rst#inode-properties

The correct part of the comment is:
# With nested xino lower, all inode numbers overflow xino bits
Meaning that all inode numbers at $lowertestdir have the MSB set
(e.g. file ino 9223372045445496836  = 0x80000002000C0004)

With lower fs xfs, the other part of the comment is also correct:
# ...and d_ino/i_ino in nested overlay are the same as in lower overlay

Because in the lower overlay ($SCRATCH_MNT/lowertestdir)
lower files also have the MSB set.

However, because ext4 has a known inode number limit of 32bit
(see ovl_can_decode_fh) the lower overlay inodes do not have the
MSB set (e.g. file ino 8590721028 = 0x2000C0004).

Long story short, I think we need to remove this line and comment
from the test and leave it the same as overlay/070:

# Record inode numbers before copy up
record_inode_numbers $lowertestdir $tmp.before.lo
record_inode_numbers $uppertestdir $tmp.before.up

This recording is just for the sake of logging info in 070.full.

>
> Best Regards,
> Xiao Yang
> On 2020/9/30 13:04, Xiao Yang wrote:
> > Replace undefined OVL_BASE_SCRATCH_DIR with OVL_BASE_SCRATCH_MNT
> >
> > Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>

Reviewed-by: Amir Goldstein <amir73il@gmail.com>

Will you also fix the test bug please.

Thanks!
Amir.
Xiao Yang Sept. 30, 2020, 2:05 p.m. UTC | #3
On 2020/9/30 15:54, Amir Goldstein wrote:
> On Wed, Sep 30, 2020 at 8:33 AM Xiao Yang<yangx.jy@cn.fujitsu.com>  wrote:
>> Hi Amir,
>>
>> I always got diffenent inode number if underlying fileystem is ext4.
>> ------------------------------------------------
>> # diff -u /var/lib/xfstests/tests/overlay/071.out
>> /var/lib/xfstests/results//overlay/071.out.bad
>> --- /var/lib/xfstests/tests/overlay/071.out 2020-09-30
>> 12:59:30.478968816 +0800
>> +++ /var/lib/xfstests/results//overlay/071.out.bad 2020-09-30
>> 13:13:02.342920819 +0800
>> @@ -1,2 +1,26 @@
>> QA output created by 071
>> +--- /tmp/25096.lower.lo 2020-09-30 13:12:59.594920981 +0800
>> ++++ /tmp/25096.before.lo 2020-09-30 13:12:59.706920975 +0800
>> +@@ -1,7 +1,7 @@
>> +-8590721028 file
>> +-8590721029 symlink
>> +-8590721030 link
>> +-8590721031 chrdev
>> +-8590721032 blkdev
>> +-8590721033 fifo
>> +-8590721034 socket
>> ++9223372045445496836 file
>> ++9223372045445496837 symlink
>> ++9223372045445496838 link
>> ++9223372045445496839 chrdev
>> ++9223372045445496840 blkdev
>> ++9223372045445496841 fifo
>> ++9223372045445496842 socket
>> +file not found by ino 8590721028 (from /tmp/25096.lower.lo) - see
>> /var/lib/xfstests/results//overlay/071.full
>> +symlink not found by ino 8590721029 (from /tmp/25096.lower.lo) - see
>> /var/lib/xfstests/results//overlay/071.full
>> +link not found by ino 8590721030 (from /tmp/25096.lower.lo) - see
>> /var/lib/xfstests/results//overlay/071.full
>> +chrdev not found by ino 8590721031 (from /tmp/25096.lower.lo) - see
>> /var/lib/xfstests/results//overlay/071.full
>> +blkdev not found by ino 8590721032 (from /tmp/25096.lower.lo) - see
>> /var/lib/xfstests/results//overlay/071.full
>> +fifo not found by ino 8590721033 (from /tmp/25096.lower.lo) - see
>> /var/lib/xfstests/results//overlay/071.full
>> +socket not found by ino 8590721034 (from /tmp/25096.lower.lo) - see
>> /var/lib/xfstests/results//overlay/071.full
>> Silence is golde
>> ------------------------------------------------
>> Is this expected behavior? :-)
> Yes and No :-)
>
> The result is expected. It is not expected for the test to fail.
> This is a test bug.
>
> The bug is in this line and in the comment above it:
> # Compare inode numbers in lower overlay vs. nested overlay
> # With nested xino lower/lower, all inode numbers overflow xino bits and
> # d_ino/i_ino in nested overlay are the same as in lower overlay.
> check_inode_numbers $lowertestdir $tmp.lower.lo $tmp.before.lo
>
> This test is meant to cover the case of "xino=on/auto, ino overflow" from:
> https://github.com/torvalds/linux/blob/master/Documentation/filesystems/overlayfs.rst#inode-properties
>
> The correct part of the comment is:
> # With nested xino lower, all inode numbers overflow xino bits
> Meaning that all inode numbers at $lowertestdir have the MSB set
> (e.g. file ino 9223372045445496836  = 0x80000002000C0004)
>
> With lower fs xfs, the other part of the comment is also correct:
> # ...and d_ino/i_ino in nested overlay are the same as in lower overlay
>
> Because in the lower overlay ($SCRATCH_MNT/lowertestdir)
> lower files also have the MSB set.
>
> However, because ext4 has a known inode number limit of 32bit
> (see ovl_can_decode_fh) the lower overlay inodes do not have the
> MSB set (e.g. file ino 8590721028 = 0x2000C0004).
>
> Long story short, I think we need to remove this line and comment
> from the test and leave it the same as overlay/070:
>
> # Record inode numbers before copy up
> record_inode_numbers $lowertestdir $tmp.before.lo
> record_inode_numbers $uppertestdir $tmp.before.up
>
> This recording is just for the sake of logging info in 070.full.
Hi Amir,

Thanks a lot for your detailed explanation. :-)
I will spend time to read the related code in kernel.

>> Best Regards,
>> Xiao Yang
>> On 2020/9/30 13:04, Xiao Yang wrote:
>>> Replace undefined OVL_BASE_SCRATCH_DIR with OVL_BASE_SCRATCH_MNT
>>>
>>> Signed-off-by: Xiao Yang<yangx.jy@cn.fujitsu.com>
> Reviewed-by: Amir Goldstein<amir73il@gmail.com>
>
> Will you also fix the test bug please.

Sure, I will fix the test bug on a separate patch tomorrow.

Best Regards,
Xiao Yang
> Thanks!
> Amir.
>
>
> .
>
diff mbox series

Patch

diff --git a/tests/overlay/071 b/tests/overlay/071
index f18429c9..ac2324c8 100755
--- a/tests/overlay/071
+++ b/tests/overlay/071
@@ -59,9 +59,9 @@  lower=$OVL_BASE_TEST_DIR/$OVL_LOWER-$seq
 upper=$OVL_BASE_SCRATCH_MNT/$OVL_UPPER
 work=$OVL_BASE_SCRATCH_MNT/$OVL_WORK
 # Lower dir of nested overlay is the scratch overlay mount at SCRATCH_MNT
-upper2=$OVL_BASE_SCRATCH_DIR/$OVL_UPPER.2
-work2=$OVL_BASE_SCRATCH_DIR/$OVL_WORK.2
-mnt2=$OVL_BASE_SCRATCH_DIR/$OVL_MNT.2
+upper2=$OVL_BASE_SCRATCH_MNT/$OVL_UPPER.2
+work2=$OVL_BASE_SCRATCH_MNT/$OVL_WORK.2
+mnt2=$OVL_BASE_SCRATCH_MNT/$OVL_MNT.2
 
 lowerdir=$lower/lowertestdir
 upperdir=$upper/uppertestdir