From: Jan Kara <jack@suse.cz>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Jan Kara <jack@suse.cz>, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 1/7] fsnotify: generalize handle_inode_event()
Date: Thu, 3 Dec 2020 10:51:01 +0100 [thread overview]
Message-ID: <20201203095101.GA11854@quack2.suse.cz> (raw)
In-Reply-To: <20201202120713.702387-2-amir73il@gmail.com>
On Wed 02-12-20 14:07:07, Amir Goldstein wrote:
> The handle_inode_event() interface was added as (quoting comment):
> "a simple variant of handle_event() for groups that only have inode
> marks and don't have ignore mask".
>
> In other words, all backends except fanotify. The inotify backend
> also falls under this category, but because it required extra arguments
> it was left out of the initial pass of backends conversion to the
> simple interface.
>
> This results in code duplication between the generic helper
> fsnotify_handle_event() and the inotify_handle_event() callback
> which also happen to be buggy code.
>
> Generalize the handle_inode_event() arguments and add the check for
> FS_EXCL_UNLINK flag to the generic helper, so inotify backend could
> be converted to use the simple interface.
>
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
The patch looks good to me. Just one curious question below.
> +static int fsnotify_handle_inode_event(struct fsnotify_group *group,
> + struct fsnotify_mark *inode_mark,
> + u32 mask, const void *data, int data_type,
> + struct inode *dir, const struct qstr *name,
> + u32 cookie)
> +{
> + const struct path *path = fsnotify_data_path(data, data_type);
> + struct inode *inode = fsnotify_data_inode(data, data_type);
> + const struct fsnotify_ops *ops = group->ops;
> +
> + if (WARN_ON_ONCE(!ops->handle_inode_event))
> + return 0;
> +
> + if ((inode_mark->mask & FS_EXCL_UNLINK) &&
> + path && d_unlinked(path->dentry))
> + return 0;
When I was looking at this condition I was wondering why do we check
d_unlinked() and not inode->i_nlink? When is there a difference?
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
next prev parent reply other threads:[~2020-12-03 9:51 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-02 12:07 [PATCH 0/7] fsnotify fixes and cleanups Amir Goldstein
2020-12-02 12:07 ` [PATCH 1/7] fsnotify: generalize handle_inode_event() Amir Goldstein
2020-12-03 9:51 ` Jan Kara [this message]
2020-12-03 10:41 ` Amir Goldstein
2020-12-03 12:02 ` Jan Kara
2020-12-02 12:07 ` [PATCH 2/7] inotify: convert to handle_inode_event() interface Amir Goldstein
2020-12-03 9:55 ` Jan Kara
2020-12-03 10:45 ` Amir Goldstein
2020-12-03 12:37 ` Jan Kara
2020-12-03 12:43 ` Amir Goldstein
2020-12-02 12:07 ` [PATCH 3/7] fsnotify: fix events reported to watching parent and child Amir Goldstein
2020-12-03 11:53 ` Jan Kara
2020-12-03 12:58 ` Amir Goldstein
2020-12-03 14:24 ` Jan Kara
2020-12-02 12:07 ` [PATCH 4/7] fsnotify: clarify object type argument Amir Goldstein
2020-12-02 12:07 ` [PATCH 5/7] fsnotify: separate mark iterator type from object type enum Amir Goldstein
2020-12-02 12:07 ` [PATCH 6/7] fsnotify: optimize FS_MODIFY events with no ignored masks Amir Goldstein
2020-12-02 12:07 ` [PATCH 7/7] fsnotify: optimize merging of marks " Amir Goldstein
2020-12-03 10:35 ` Jan Kara
2020-12-03 10:56 ` Amir Goldstein
2020-12-03 14:52 ` [PATCH 0/7] fsnotify fixes and cleanups Jan Kara
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=20201203095101.GA11854@quack2.suse.cz \
--to=jack@suse.cz \
--cc=amir73il@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).