fsnotify: generalize handle_inode_event()
commit 950cc0d2bef078e1f6459900ca4d4b2a2e0e3c37 upstream.
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.
Link: https://lore.kernel.org/r/20201202120713.702387-2-amir73il@gmail.com
CC: stable@vger.kernel.org
Fixes: b9a1b97725
("fsnotify: create method handle_inode_event() in fsnotify_operations")
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
1aa8e7801e
commit
c9be99c861
@@ -137,6 +137,7 @@ struct mem_cgroup;
|
||||
* if @file_name is not NULL, this is the directory that
|
||||
* @file_name is relative to.
|
||||
* @file_name: optional file name associated with event
|
||||
* @cookie: inotify rename cookie
|
||||
*
|
||||
* free_group_priv - called when a group refcnt hits 0 to clean up the private union
|
||||
* freeing_mark - called when a mark is being destroyed for some reason. The group
|
||||
@@ -151,7 +152,7 @@ struct fsnotify_ops {
|
||||
struct fsnotify_iter_info *iter_info);
|
||||
int (*handle_inode_event)(struct fsnotify_mark *mark, u32 mask,
|
||||
struct inode *inode, struct inode *dir,
|
||||
const struct qstr *file_name);
|
||||
const struct qstr *file_name, u32 cookie);
|
||||
void (*free_group_priv)(struct fsnotify_group *group);
|
||||
void (*freeing_mark)(struct fsnotify_mark *mark, struct fsnotify_group *group);
|
||||
void (*free_event)(struct fsnotify_event *event);
|
||||
|
Reference in New Issue
Block a user