From: Jan Kara <jack@suse.cz>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Jan Kara <jack@suse.cz>, Matthew Bobrowski <repnop@google.com>,
Ivan Delalande <colona@arista.com>,
Al Viro <viro@zeniv.linux.org.uk>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
stable <stable@vger.kernel.org>
Subject: Re: [PATCH] fnotify: invalidate dcache before IN_DELETE event
Date: Thu, 20 Jan 2022 16:31:22 +0100 [thread overview]
Message-ID: <20220120153122.fpxg24okcmcvkcay@quack3.lan> (raw)
In-Reply-To: <CAOQ4uxjxayK006RDAiEm9hKP_JAZhZZDcj7tbnANjQWP-_XObA@mail.gmail.com>
On Thu 20-01-22 16:31:11, Amir Goldstein wrote:
> On Thu, Jan 20, 2022 at 2:52 PM Jan Kara <jack@suse.cz> wrote:
> > > +/*
> > > + * fsnotify_delete - @dentry was unlinked and unhashed
> > > + *
> > > + * Caller must make sure that dentry->d_name is stable.
> > > + *
> > > + * Note: unlike fsnotify_unlink(), we have to pass also the unlinked inode
> > > + * as this may be called after d_delete() and old_dentry may be negative.
> > > + */
> > > +static inline void fsnotify_delete(struct inode *dir, struct inode *inode,
> > > + struct dentry *dentry)
> > > +{
> > > + __u32 mask = FS_DELETE;
> > > +
> > > + if (S_ISDIR(inode->i_mode))
> > > + mask |= FS_ISDIR;
> > > +
> > > + fsnotify_name(mask, inode, FSNOTIFY_EVENT_INODE, dir, &dentry->d_name,
> > > + 0);
> > > +}
> > > +
> >
> > OK, this is fine because we use dentry only for FAN_RENAME event, don't we?
>
> Almost.
> We also use dentry in FS_CREATE to get sb from d_sb for error event, because:
> * Note: some filesystems (e.g. kernfs) leave @dentry negative and instantiate
> * ->d_inode later
Ah, right.
> > In all other cases we always use only inode anyway. Can we perhaps cleanup
> > include/linux/fsnotify.h to use FSNOTIFY_EVENT_DENTRY only in that one call
> > site inside fsnotify_move() and use FSNOTIFY_EVENT_INODE in all the other
> > cases? So that this is clear and also so that we don't start using dentry
> > inadvertedly for something inside fsnotify thus breaking unlink reporting
> > in subtle ways...
> >
>
> I don't know.
> For fsnotify_unlink/rmdir we check d_is_negative, so it's fine to use
> FSNOTIFY_EVENT_INODE.
> For fsnotify_link,fsnotify_move we get the inode explicitly, but we already
> use FSNOTIFY_EVENT_INODE in those cases (except FS_RENAME).
Yeah, plus we have the xattr and attrib events which need dentry to lookup
parent. So scratch this idea.
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
prev parent reply other threads:[~2022-01-20 15:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-18 12:00 [PATCH] fnotify: invalidate dcache before IN_DELETE event Amir Goldstein
2022-01-18 12:27 ` Amir Goldstein
2022-01-20 12:52 ` Jan Kara
2022-01-20 14:31 ` Amir Goldstein
2022-01-20 15:31 ` Jan Kara [this message]
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=20220120153122.fpxg24okcmcvkcay@quack3.lan \
--to=jack@suse.cz \
--cc=amir73il@gmail.com \
--cc=colona@arista.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=repnop@google.com \
--cc=stable@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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