linux-unionfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/5] Test overlayfs readdir cache
@ 2021-04-25  7:14 Amir Goldstein
  2021-04-25  7:14 ` [PATCH v2 1/5] src/t_dir_offset2: Add an option to limit of buffer size Amir Goldstein
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Amir Goldstein @ 2021-04-25  7:14 UTC (permalink / raw)
  To: Eryu Guan; +Cc: Miklos Szeredi, linux-unionfs, fstests

Eryu,

This extends the generic t_dir_offset2 helper program to verify
some cases of missing/stale entries and adds a new generic test which
passes on overlayfs (and other fs) on upstream kernel.

The overlayfs specific test fails on upstream kernel and the fix commit
is currently in linux-next.  As usual, you may want to wait with merging
until the fix commit hits upstream.

Based on feedback from Miklos, I changed the test to check for the
missing/stale entries on a new fd, while old fd is kept open, because
POSIX allows for stale/missing entries in the old fd.

I was looking into another speculated bug in overlayfs which involves
multiple calls to getdents.  Although it turned out that overlayfs does
not have the speculated bug, I left both generic and overlay test with
multiple calls to getdents in order to excersize the relevant code.

The attached patch was used to verify that the overlayfs test excercises
the call to ovl_cache_update_ino() with stale entries.
Overlayfs populates the merge dir readdir cache with a list of files in
the first getdents call, but updates d_ino of files on the list in
subsequent getdents calls.  By that time, the last entry is stale and the
following warning is printed (on linux-next with patch below applied):
[   ] overlayfs: failed to look up (m100) for ino (0)
[   ] overlayfs: failed to look up (f100) for ino (0)

Miklos,

Do you think it is worth the trouble to set p->is_whiteout and skip
dir_emit() in this case? and do we need to worry about lookup_one_len()
returning -ENOENT in this case?

Thanks,
Amir.

Changes since v1:
- Use small getdents buffer to force multiple calls
- Tidy up new command line options for t_dir_offset2
- Check missing/stale entries on new fd
- Add impure dir use case to overlay test

Amir Goldstein (5):
  src/t_dir_offset2: Add an option to limit of buffer size
  src/t_dir_offset2: Add an option to find file by name
  src/t_dir_offset2: Add option to create or unlink file
  generic: Test readdir of modified directrory
  overlay: Test invalidate of readdir cache

 src/t_dir_offset2.c   | 113 ++++++++++++++++++++++++++++++++++++++--
 tests/generic/700     |  62 ++++++++++++++++++++++
 tests/generic/700.out |   2 +
 tests/generic/group   |   1 +
 tests/overlay/077     | 117 ++++++++++++++++++++++++++++++++++++++++++
 tests/overlay/077.out |   2 +
 tests/overlay/group   |   1 +
 7 files changed, 293 insertions(+), 5 deletions(-)
 create mode 100755 tests/generic/700
 create mode 100644 tests/generic/700.out
 create mode 100755 tests/overlay/077
 create mode 100644 tests/overlay/077.out

--
diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c
index cc1e80257064..cadcbfafa179 100644
--- a/fs/overlayfs/readdir.c
+++ b/fs/overlayfs/readdir.c
@@ -486,7 +486,7 @@ static int ovl_cache_update_ino(struct path *path, struct ovl_cache_entry *p)
                        this = NULL;
                        goto fail;
                }
-               goto out;
+               goto fail;
        }
 
 get:
-- 
2.31.1


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

end of thread, other threads:[~2021-04-26 15:22 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-25  7:14 [PATCH v2 0/5] Test overlayfs readdir cache Amir Goldstein
2021-04-25  7:14 ` [PATCH v2 1/5] src/t_dir_offset2: Add an option to limit of buffer size Amir Goldstein
2021-04-25  7:14 ` [PATCH v2 2/5] src/t_dir_offset2: Add an option to find file by name Amir Goldstein
2021-04-25  7:14 ` [PATCH v2 3/5] src/t_dir_offset2: Add option to create or unlink file Amir Goldstein
2021-04-25  7:14 ` [PATCH v2 4/5] generic: Test readdir of modified directrory Amir Goldstein
2021-04-25  7:14 ` [PATCH v2 5/5] overlay: Test invalidate of readdir cache Amir Goldstein
2021-04-26 10:07 ` [PATCH v2 0/5] Test overlayfs " Miklos Szeredi
2021-04-26 10:15   ` Amir Goldstein
2021-04-26 13:12     ` Miklos Szeredi
2021-04-26 15:22       ` Amir Goldstein

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).