public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: NeilBrown <neilb@suse.de>
Cc: Aishwarya.TCV@arm.com, Jan Kara <jack@suse.cz>,
	linux-nfs@vger.kernel.org, broonie@kernel.org,
	ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] NFS: add atomic_open for NFSv3 to handle O_TRUNC correctly.
Date: Wed, 12 Jun 2024 09:12:52 +0200	[thread overview]
Message-ID: <20240612071252.GA98398@pevik> (raw)
In-Reply-To: <171815759406.14261.8092450471234028375@noble.neil.brown.name>

> On Tue, 11 Jun 2024, Amir Goldstein wrote:
> > On Tue, Jun 11, 2024 at 5:30 AM NeilBrown <neilb@suse.de> wrote:

> > > On Fri, 07 Jun 2024, James Clark wrote:

> > > > Hi Neil,

> > > > Now that your fix is in linux-next the statvfs01 test is passing again.
> > > > However inotify02 is still failing.

> > > > This is because the test expects the IN_CREATE and IN_OPEN events to
> > > > come in that order after calling creat(), but now they are reversed. To
> > > > me it seems like it could be a test issue and the test should handle
> > > > them in either order? Or maybe there should be a single inotify event
> > > > with both flags set for the atomic open?

> > > Interesting....  I don't see how any filesystem that uses ->atomic_open
> > > would get these in the "right" order - and I do think IN_CREATE should
> > > come before IN_OPEN.

> > Correct.


> > > Does NFSv4 pass this test?

> > Probably not.


> > > IN_OPEN is generated (by fsnotify_open()) when finish_open() is called,
> > > which must be (and is) called by all atomic_open functions.
> > > IN_CREATE is generated (by fsnotify_create()) when open_last_lookups()
> > > detects that FMODE_CREATE was set and that happens *after* lookup_open()
> > > is called, which calls atomic_open().

> > > For filesystems that don't use atomic_open, the IN_OPEN is generated by
> > > the call to do_open() which happens *after* open_last_lookups(), not
> > > inside it.

> > Correct.


> > > So the ltp test must already fail for NFSv4, 9p ceph fuse gfs2 ntfs3
> > > overlayfs smb.


> > inotify02 does not run on all_filesystems, only on the main test fs,
> > which is not very often one of the above.

> > This is how I averted the problem in fanotify16 (which does run on
> > all_filesystems):

> > commit 9062824a70b8da74aa5b1db08710d0018b48072e
> > Author: Amir Goldstein <amir73il@gmail.com>
> > Date:   Tue Nov 21 12:52:47 2023 +0200

> >     fanotify16: Fix test failure on FUSE

> >     Split SAFE_CREAT() into explicit SAFE_MKNOD() and SAFE_OPEN(),
> >     because with atomic open (e.g. fuse), SAFE_CREAT() generates FAN_OPEN
> >     before FAN_CREATE (tested with ntfs-3g), which is inconsistent with
> >     the order of events expected from other filesystems.

> > inotify02 should be fixed similarly.

> Alternately - maybe the kernel should be fixed to always get the order
> right.
> I have a patch.  I'll post it separately.

@Amir, if later Neil's branch get merged, maybe we should use on fanotify16
creat() on the old kernels (as it was in before your fix 9062824a7 ("fanotify16:
Fix test failure on FUSE")), based on kernel check.

Kind regards,
Petr

> Thanks for your confirmation that my understanding is correct!

> NeilBrown



> > I did not find any other inotify test that watches IN_CREATE.
> > I did not find any other fanotify test that watches both FAN_CREATE
> > and FAN_OPEN.

> > Thanks,
> > Amir.



-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2024-06-12  7:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <171134496555.13576.1334297096866165638@noble.neil.brown.name>
2024-05-28 10:52 ` [LTP] [PATCH] NFS: add atomic_open for NFSv3 to handle O_TRUNC correctly James Clark
2024-05-28 21:50   ` NeilBrown
2024-06-07 10:49     ` James Clark
2024-06-11  2:29       ` NeilBrown
2024-06-11  6:44         ` Amir Goldstein
2024-06-12  1:59           ` NeilBrown
2024-06-12  7:12             ` Petr Vorel [this message]
2024-06-13 10:26               ` Amir Goldstein
2024-06-14  8:18                 ` Petr Vorel

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=20240612071252.GA98398@pevik \
    --to=pvorel@suse.cz \
    --cc=Aishwarya.TCV@arm.com \
    --cc=broonie@kernel.org \
    --cc=jack@suse.cz \
    --cc=linux-nfs@vger.kernel.org \
    --cc=ltp@lists.linux.it \
    --cc=neilb@suse.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox