summaryrefslogtreecommitdiffstats
path: root/fs/notify/fanotify
diff options
context:
space:
mode:
authorAmir Goldstein2018-06-23 16:54:48 +0200
committerJan Kara2018-06-27 13:45:03 +0200
commitb812a9f5896379b6cff2ac168ddb5b89037d8e78 (patch)
tree459d434209e3b4d07d5949159b5c5d8ea0829d26 /fs/notify/fanotify
parentfsnotify: use typedef fsnotify_connp_t for brevity (diff)
downloadkernel-qcow2-linux-b812a9f5896379b6cff2ac168ddb5b89037d8e78.tar.gz
kernel-qcow2-linux-b812a9f5896379b6cff2ac168ddb5b89037d8e78.tar.xz
kernel-qcow2-linux-b812a9f5896379b6cff2ac168ddb5b89037d8e78.zip
fsnotify: pass connp and object type to fsnotify_add_mark()
Instead of passing inode and vfsmount arguments to fsnotify_add_mark() and its _locked variant, pass an abstract object pointer and the object type. The helpers fsnotify_obj_{inode,mount} are added to get the concrete object pointer from abstract object pointer. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/notify/fanotify')
-rw-r--r--fs/notify/fanotify/fanotify_user.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index ec4d8c59d0e3..81212b251189 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -615,8 +615,8 @@ static __u32 fanotify_mark_add_to_mask(struct fsnotify_mark *fsn_mark,
}
static struct fsnotify_mark *fanotify_add_new_mark(struct fsnotify_group *group,
- struct inode *inode,
- struct vfsmount *mnt)
+ fsnotify_connp_t *connp,
+ unsigned int type)
{
struct fsnotify_mark *mark;
int ret;
@@ -629,7 +629,7 @@ static struct fsnotify_mark *fanotify_add_new_mark(struct fsnotify_group *group,
return ERR_PTR(-ENOMEM);
fsnotify_init_mark(mark, group);
- ret = fsnotify_add_mark_locked(mark, inode, mnt, 0);
+ ret = fsnotify_add_mark_locked(mark, connp, type, 0);
if (ret) {
fsnotify_put_mark(mark);
return ERR_PTR(ret);
@@ -643,14 +643,15 @@ static int fanotify_add_vfsmount_mark(struct fsnotify_group *group,
struct vfsmount *mnt, __u32 mask,
unsigned int flags)
{
+ fsnotify_connp_t *connp = &real_mount(mnt)->mnt_fsnotify_marks;
struct fsnotify_mark *fsn_mark;
__u32 added;
mutex_lock(&group->mark_mutex);
- fsn_mark = fsnotify_find_mark(&real_mount(mnt)->mnt_fsnotify_marks,
- group);
+ fsn_mark = fsnotify_find_mark(connp, group);
if (!fsn_mark) {
- fsn_mark = fanotify_add_new_mark(group, NULL, mnt);
+ fsn_mark = fanotify_add_new_mark(group, connp,
+ FSNOTIFY_OBJ_TYPE_VFSMOUNT);
if (IS_ERR(fsn_mark)) {
mutex_unlock(&group->mark_mutex);
return PTR_ERR(fsn_mark);
@@ -669,6 +670,7 @@ static int fanotify_add_inode_mark(struct fsnotify_group *group,
struct inode *inode, __u32 mask,
unsigned int flags)
{
+ fsnotify_connp_t *connp = &inode->i_fsnotify_marks;
struct fsnotify_mark *fsn_mark;
__u32 added;
@@ -685,9 +687,10 @@ static int fanotify_add_inode_mark(struct fsnotify_group *group,
return 0;
mutex_lock(&group->mark_mutex);
- fsn_mark = fsnotify_find_mark(&inode->i_fsnotify_marks, group);
+ fsn_mark = fsnotify_find_mark(connp, group);
if (!fsn_mark) {
- fsn_mark = fanotify_add_new_mark(group, inode, NULL);
+ fsn_mark = fanotify_add_new_mark(group, connp,
+ FSNOTIFY_OBJ_TYPE_INODE);
if (IS_ERR(fsn_mark)) {
mutex_unlock(&group->mark_mutex);
return PTR_ERR(fsn_mark);