Re: [PATCH 14/33] fsnotify: Remove indirection from fsnotify_detach_mark()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 15, 2017 at 12:46 PM, Jan Kara <jack@xxxxxxx> wrote:
> fsnotify_detach_mark() calls fsnotify_destroy_inode_mark() or
> fsnotify_destroy_vfsmount_mark() to remove mark from object list. These
> two functions are however very similar and differ only in the lock they
> use to protect the object list of marks. Simplify the code by removing
> the indirection and removing mark from the object list in a common
> function.
>
> Signed-off-by: Jan Kara <jack@xxxxxxx>

Reviewed-by: Amir Goldstein <amir73il@xxxxxxxxx>

except for another case of fsnotify_object_lock()

[...]
> diff --git a/fs/notify/mark.c b/fs/notify/mark.c
> index e808378e468a..cbc7149e17a3 100644
> --- a/fs/notify/mark.c
> +++ b/fs/notify/mark.c
> @@ -146,6 +146,31 @@ void fsnotify_recalc_mask(struct fsnotify_mark_connector *conn)
>         }
>  }
>
> +static struct inode *fsnotify_detach_from_object(struct fsnotify_mark *mark)
> +{
> +       struct fsnotify_mark_connector *conn;
> +       struct inode *inode = NULL;
> +       spinlock_t *lock;
> +
> +       conn = mark->connector;
> +       if (conn->flags & FSNOTIFY_OBJ_TYPE_INODE)
> +               lock = &conn->inode->i_lock;
> +       else
> +               lock = &conn->mnt->mnt_root->d_lock;

 lock = fsnotify_object_lock(conn);

> +       spin_lock(lock);
> +       hlist_del_init_rcu(&mark->obj_list);
> +       if (hlist_empty(&conn->list)) {
> +               if (conn->flags & FSNOTIFY_OBJ_TYPE_INODE)
> +                       inode = conn->inode;
> +       } else {
> +               __fsnotify_recalc_mask(conn);
> +       }
> +       mark->connector = NULL;
> +       spin_unlock(lock);
> +
> +       return inode;
> +}
> +



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux