Skip to contentSkip to conversation

overlay/029: fix test failure with index feature enabled

PATCH Superseded Amir Goldstein 2 participants 5 messages Apr 9, 2020 – Apr 19, 2020

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 overlay/029: fix test failure with index feature enabled

When overlayfs index feature is enabled by default in either kernel config or module parameters, this test fails:

mount: /tmp/8751/mnt: mount(2) system call failed: Stale file handle.
cat: /tmp/8751/mnt/bar: No such file or directory

The reason is that with index feature enabled, an upper/work dirs cannot be reused for mounting with a different lower layer.

---
 tests/overlay/029 | 6 ++++++
 1 file changed, 6 insertions(+)
tests/overlay/029 +6 -0
index 1d2d2092..17f58de7 100755
@@ -68,12 +68,18 @@ _overlay_mount_dirs $SCRATCH_MNT/up $tmp/{upper,work} \
 cat $tmp/mnt/foo
 $UMOUNT_PROG $tmp/mnt
 
+# re-create upper/work to avoid ovl_verify_origin() mount failure
+# when index is enabled
+rm -rf $tmp/{upper,work}
+mkdir -p $tmp/{upper,work}
 # mount overlay again using lower dir from SCRATCH_MNT dir
 _overlay_mount_dirs $SCRATCH_MNT/low $tmp/{upper,work} \
   overlay $tmp/mnt
 cat $tmp/mnt/bar
 $UMOUNT_PROG $tmp/mnt
 
+rm -rf $tmp/{upper,work}
+mkdir -p $tmp/{upper,work}
 # mount overlay again using SCRATCH_MNT dir
 _overlay_mount_dirs $SCRATCH_MNT/ $tmp/{upper,work} \
   overlay $tmp/mnt
Signature · 1 line
2.17.1
#1 lore raw
Quoted 8 lines · Amir Goldstein

When overlayfs index feature is enabled by default in either kernel config or module parameters, this test fails:

mount: /tmp/8751/mnt: mount(2) system call failed: Stale file handle.
cat: /tmp/8751/mnt/bar: No such file or directory

The reason is that with index feature enabled, an upper/work dirs cannot be reused for mounting with a different lower layer.

I re-built my test kernel with CONFIG_OVERLAY_FS_INDEX=y, and confirmed /sys/module/overlay/parameters/index is 'Y', but test still passes for me. And I do notice the following info in dmesg:

[  598.663923] overlayfs: fs on '/mnt/scratch/ovl-mnt/up' does not support file handles, falling back to index=off,nfs_export=off.
[  598.674299] overlayfs: fs on '/mnt/scratch/ovl-mnt/low' does not support file handles, falling back to index=off,nfs_export=off.
[  598.684594] overlayfs: fs on '/mnt/scratch/ovl-mnt/' does not support file handles, falling back to index=off,nfs_export=off.

Seems it has something to do with nfs_export feature? I have it disabled by default.

# CONFIG_OVERLAY_FS_NFS_EXPORT is not set

Could you please help confirm?

Thanks,
Eryu

Quoted 33 lines
---
 tests/overlay/029 | 6 ++++++
 1 file changed, 6 insertions(+)
tests/overlay/029 +6 -0
index 1d2d2092..17f58de7 100755
@@ -68,12 +68,18 @@ _overlay_mount_dirs $SCRATCH_MNT/up $tmp/{upper,work} \
 cat $tmp/mnt/foo
 $UMOUNT_PROG $tmp/mnt
 
+# re-create upper/work to avoid ovl_verify_origin() mount failure
+# when index is enabled
+rm -rf $tmp/{upper,work}
+mkdir -p $tmp/{upper,work}
 # mount overlay again using lower dir from SCRATCH_MNT dir
 _overlay_mount_dirs $SCRATCH_MNT/low $tmp/{upper,work} \
   overlay $tmp/mnt
 cat $tmp/mnt/bar
 $UMOUNT_PROG $tmp/mnt
 
+rm -rf $tmp/{upper,work}
+mkdir -p $tmp/{upper,work}
 # mount overlay again using SCRATCH_MNT dir
 _overlay_mount_dirs $SCRATCH_MNT/ $tmp/{upper,work} \
   overlay $tmp/mnt
Signature · 1 line
2.17.1
#2 lore raw
Quoted 19 lines · Eryu Guan
Quoted 8 lines · Amir Goldstein

When overlayfs index feature is enabled by default in either kernel config or module parameters, this test fails:

mount: /tmp/8751/mnt: mount(2) system call failed: Stale file handle.
cat: /tmp/8751/mnt/bar: No such file or directory

The reason is that with index feature enabled, an upper/work dirs cannot be reused for mounting with a different lower layer.

I re-built my test kernel with CONFIG_OVERLAY_FS_INDEX=y, and confirmed /sys/module/overlay/parameters/index is 'Y', but test still passes for me. And I do notice the following info in dmesg:

[  598.663923] overlayfs: fs on '/mnt/scratch/ovl-mnt/up' does not support file handles, falling back to index=off,nfs_export=off.
[  598.674299] overlayfs: fs on '/mnt/scratch/ovl-mnt/low' does not support file handles, falling back to index=off,nfs_export=off.
[  598.684594] overlayfs: fs on '/mnt/scratch/ovl-mnt/' does not support file handles, falling back to index=off,nfs_export=off.
Quoted 7 lines

Seems it has something to do with nfs_export feature? I have it disabled by default.

# CONFIG_OVERLAY_FS_NFS_EXPORT is not set

Could you please help confirm?

I confirm. enabling index on nested overlay requires that the lower overlay has nfs_export enabled.

Missed that, but in the bug report, CONFIG_OVERLAY_FS_NFS_EXPORT was indeed set.

You do not need to rebuild the kernel.
You can reproduce the failure by setting overlay module parameter before running the tests.

echo Y > /sys/module/overlay/parameters/index echo Y > /sys/module/overlay/parameters/nfs_export

Thanks,
Amir.

#3 lore raw
Quoted 23 lines · Amir Goldstein
Quoted 22 lines · Eryu Guan
Quoted 8 lines · Amir Goldstein

When overlayfs index feature is enabled by default in either kernel config or module parameters, this test fails:

mount: /tmp/8751/mnt: mount(2) system call failed: Stale file handle.
cat: /tmp/8751/mnt/bar: No such file or directory

The reason is that with index feature enabled, an upper/work dirs cannot be reused for mounting with a different lower layer.

I re-built my test kernel with CONFIG_OVERLAY_FS_INDEX=y, and confirmed /sys/module/overlay/parameters/index is 'Y', but test still passes for me. And I do notice the following info in dmesg:

[  598.663923] overlayfs: fs on '/mnt/scratch/ovl-mnt/up' does not support file handles, falling back to index=off,nfs_export=off.
[  598.674299] overlayfs: fs on '/mnt/scratch/ovl-mnt/low' does not support file handles, falling back to index=off,nfs_export=off.
[  598.684594] overlayfs: fs on '/mnt/scratch/ovl-mnt/' does not support file handles, falling back to index=off,nfs_export=off.

Seems it has something to do with nfs_export feature? I have it disabled by default.

Quoted 7 lines
Quoted 4 lines

# CONFIG_OVERLAY_FS_NFS_EXPORT is not set

Could you please help confirm?

I confirm. enabling index on nested overlay requires that the lower overlay has nfs_export enabled.

Thanks!

Quoted 3 lines

Missed that, but in the bug report, CONFIG_OVERLAY_FS_NFS_EXPORT was indeed set.

Would you please update the commit log accordingly as well?

Quoted 7 lines

You do not need to rebuild the kernel.
You can reproduce the failure by setting overlay module parameter before running the tests.

echo Y > /sys/module/overlay/parameters/index echo Y > /sys/module/overlay/parameters/nfs_export

Ah, forgot about that.. it's easier now :)

Thanks,
Eryu

#4 lore raw
Quoted 33 lines · Eryu Guan
Quoted 23 lines · Amir Goldstein
Quoted 22 lines · Eryu Guan
Quoted 8 lines · Amir Goldstein

When overlayfs index feature is enabled by default in either kernel config or module parameters, this test fails:

mount: /tmp/8751/mnt: mount(2) system call failed: Stale file handle.
cat: /tmp/8751/mnt/bar: No such file or directory

The reason is that with index feature enabled, an upper/work dirs cannot be reused for mounting with a different lower layer.

I re-built my test kernel with CONFIG_OVERLAY_FS_INDEX=y, and confirmed /sys/module/overlay/parameters/index is 'Y', but test still passes for me. And I do notice the following info in dmesg:

[  598.663923] overlayfs: fs on '/mnt/scratch/ovl-mnt/up' does not support file handles, falling back to index=off,nfs_export=off.
[  598.674299] overlayfs: fs on '/mnt/scratch/ovl-mnt/low' does not support file handles, falling back to index=off,nfs_export=off.
[  598.684594] overlayfs: fs on '/mnt/scratch/ovl-mnt/' does not support file handles, falling back to index=off,nfs_export=off.

Seems it has something to do with nfs_export feature? I have it disabled by default.

Quoted 7 lines
Quoted 4 lines

# CONFIG_OVERLAY_FS_NFS_EXPORT is not set

Could you please help confirm?

I confirm. enabling index on nested overlay requires that the lower overlay has nfs_export enabled.

Quoted 8 lines

Thanks!

Quoted 3 lines

Missed that, but in the bug report, CONFIG_OVERLAY_FS_NFS_EXPORT was indeed set.

Would you please update the commit log accordingly as well?

OK.

Thanks,
Amir.