From: Petr Vorel <pvorel@suse.cz>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Jan Kara <jack@suse.cz>,
"ltp@lists.linux.it" <ltp@lists.linux.it>,
Edvard Conrad <edvard@tuta.io>
Subject: Re: [LTP] [PATCH] syscalls/fanotify26: Add cases that list the directory
Date: Tue, 3 Nov 2026 20:44:09 +0100 [thread overview]
Message-ID: <20261103194409.GB119931@pevik> (raw)
In-Reply-To: <CAOQ4uxiDYt9HtpZ7XDHdYJZKfPo0ACT4bOXKfGTwPe0WXsmNLQ@mail.gmail.com>
Hi Edvard, Amir,
TL;DR: merged, thank you. Few notes below.
> On Tue, Nov 3, 2026 at 1:14 PM Edvard Conrad <edvard@tuta.io> wrote:
> > Listing a directory through the event file descriptor makes overlayfs
> > open its layers again, after the event fd exists: every layer of a
> > merged directory in ovl_dir_read_merged(), and the upper directory of
> > an impure one in ovl_dir_read_impure(). Unless those opens inherit
> > FMODE_NONOTIFY from the event fd, a listener that marks the backing
> > filesystem and lists the directory before it answers is sent a nested
> > permission event and blocks in getdents64().
> > Add a case for each. The impure directory is made by renaming a lower
> > file into a directory created on the overlay. The case reports TCONF
> > when the overlay cannot record the file's origin and so does not mark
"the overlay cannot record the file's origin": I'm just curious how this can
happen. Obviously it's not a mistake when you chose TCONF.
> > the directory impure. The impure listing is cached with the inode, so
> > the case moves the entry out and back first; otherwise a later
> > iteration would read the cache instead of the layer.
> > Both cases fail on a kernel without the pending overlayfs fix for
> > directory opens.
> > Signed-off-by: Edvard Conrad <edvard@tuta.io>
> > ---
> > Applies on top of "syscalls/fanotify26: Add directory cases for the
> > nested event":
> > https://lore.kernel.org/ltp/P5Iny41--F-9@tuta.io/
> > Asked for by Amir on the kernel thread, where both paths came up:
> > https://lore.kernel.org/all/CAOQ4uxh67+vs0mr-Lxmwz9-N+F8m29WUNz+8qFLLDpOVYB7=vg@mail.gmail.com/
+1
> > Tested in a VM on 6b4b543fa18, each kernel run once and with -i 2,
> > with the backing filesystem marked:
> > file dir merged dir impure dir
> > listed listed
> > no fix FAIL FAIL FAIL FAIL
> > + c3d355f427ce PASS FAIL FAIL FAIL
> > + ovl directory fix, v1 PASS PASS FAIL FAIL
> > + ovl directory fix, v2 PASS PASS PASS FAIL
> > + v2 and the follow-up on PASS PASS PASS PASS
> > the kernel thread
+1. So there will be 2 kernel fixing commits.
> > The overlay-only cases pass on all of them. Without the fix the impure
> > case fails in both iterations of -i 2, which is what moving the entry
> > out and back is for.
...
> > .../kernel/syscalls/fanotify/fanotify26.c | 92 ++++++++++++++++---
> > /*
> > * The listener either answers the event at once or is blocked for good, so
> > @@ -56,19 +74,41 @@
> > #define WAIT_MSEC 5000
> > static int fd_notify = -1;
> > +static int idir_is_impure;
> > static struct tcase {
> > const char *tname;
> > + const char *path;
> > int mark_backing;
> > int ondir;
> > + int list;
> > + int impure;
> > } tcases[] = {
> > - {"Overlay mark, file", 0, 0},
> > - {"Overlay and backing mark, file", 1, 0},
> > - {"Overlay mark, directory", 0, 1},
> > - {"Overlay and backing mark, directory", 1, 1},
> > + {"Overlay mark, file", OVL_FILE, 0, 0, 0, 0},
> > + {"Overlay and backing mark, file", OVL_FILE, 1, 0, 0, 0},
> > + {"Overlay mark, directory", OVL_DIR, 0, 1, 0, 0},
> > + {"Overlay and backing mark, directory", OVL_DIR, 1, 1, 0, 0},
> > + {"Overlay and backing mark, merged directory, listed",
> > + OVL_MDIR, 1, 1, 1, 0},
> > + {"Overlay and backing mark, impure directory, listed",
> > + OVL_IDIR, 1, 1, 1, 1},
> > };
nit: I usually prefer designated initializers instead of list of 0 or 1
(readability), but that's ok.
...
> Looks good!
> Only problem I got:
> tst_supported_fs_types.c:67: TINFO: mkfs.ext2 does exist
> tst_test.c:1305: TINFO: Formatting /dev/loop0 with ext2 opts='' extra opts=''
> mke2fs 1.47.2 (1-Jan-2025)
> [ 107.271105] operation not supported error, dev loop0, sector 614272
> op 0x9:(WRITE_ZEROES) flags 0x20800800 phys_seg 0 prio class 2
> tst_test.c:1317: TINFO: Mounting /dev/loop0 to
> /tmp/LTP_fanfH7dWr/mntpoint fstyp=ext2 flags=0
> [ 107.359391] ext2 filesystem being mounted at
> /tmp/LTP_fanfH7dWr/mntpoint supports timestamps until 2038-01-19
> (0x7fffffff)
> [ 107.367943] overlayfs: upper fs does not support RENAME_WHITEOUT.
> tst_test.c:1895: TINFO: Overall timeout per run is 0h 02m 00s
> fanotify26.c:232: TINFO: Umounting /tmp/LTP_fanfH7dWr/mntpoint/ovl
> [ 107.383261] overlayfs: upper fs does not support RENAME_WHITEOUT.
> fanotify26.c:246: TBROK: rename(mntpoint/ovl/moved_file,
> mntpoint/ovl/impure_dir/moved_file) failed: EINVAL (22)
> So I added to the test:
> --- a/testcases/kernel/syscalls/fanotify/fanotify26.c
> +++ b/testcases/kernel/syscalls/fanotify/fanotify26.c
> @@ -275,6 +275,11 @@ static struct tst_test test = {
> .mount_device = 1,
> .needs_overlay = 1,
> .mntpoint = OVL_BASE_MNTPOINT,
> + /* Test requires a base filesystem that supports RENAME_WHITEOUT */
> + .filesystems = (struct tst_fs[]) {
> + {.type = "ext4"},
> + {}
> + },
> };
+1, I added it before merge.
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2026-11-03 19:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 12:14 [LTP] [PATCH] syscalls/fanotify26: Add cases that list the directory Edvard Conrad via ltp
2026-11-03 14:44 ` Amir Goldstein
2026-11-03 19:44 ` Petr Vorel [this message]
2026-11-03 18:13 ` [LTP] " linuxtestproject.agent
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261103194409.GB119931@pevik \
--to=pvorel@suse.cz \
--cc=amir73il@gmail.com \
--cc=edvard@tuta.io \
--cc=jack@suse.cz \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.