overlay/029: fix test failure with nfs_export feature enabled
authorAmir Goldstein <amir73il@gmail.com>
Mon, 20 Apr 2020 10:27:31 +0000 (13:27 +0300)
committerEryu Guan <guaneryu@gmail.com>
Sun, 10 May 2020 12:20:02 +0000 (20:20 +0800)
commitf3bdafb91bb2960bc4110935be9f66541207d0ff
tree0b5a8f9c4f2ad7dd6762bb28de4bf35be0072b48
parent50a059ceace8dbec72ae100a64861abe5dcbba2e
overlay/029: fix test failure with nfs_export feature enabled

When overlayfs nfs_export 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 nfs_export depends on index feature and with index
feature enabled, an upper/work dirs cannot be reused for mounting with
a different lower layer.

To reproduce the failure do:
  echo Y > /sys/module/overlay/parameters/index
  echo Y > /sys/module/overlay/parameters/nfs_export
before running the test.

Fix the failure by explicitly re-creating upper/work dirs.

Reported-by: Chengguang Xu <cgxu519@mykernel.net>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/overlay/029