Re: [PATCH 08/25] fsnotify: Lock object list with connector lock

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

 



On Wed, Feb 1, 2017 at 12:44 PM, Jan Kara <jack@xxxxxxx> wrote:
> So far list of marks attached to an object (inode / vfsmount) was
> protected by i_lock or mnt_root->d_lock. This dictates that the list
> must be empty before the object can be destroyed although the list is
> now anchored in the fsnotify_mark_connector structure. Protect the list
> by a spinlock in the fsnotify_mark_connector structure to decouple
> lifetime of a list of marks from a lifetime of the object. This also
> simplifies the code quite a bit since we don't have to differentiate
> between inode and vfsmount lists in quite a few places anymore.
>
> Signed-off-by: Jan Kara <jack@xxxxxxx>

Apart from one nit below, you may re-add

Reviewed-by: Amir Goldstein <amir73il@xxxxxxxxx>

...

> +
> +static struct inode *fsnotify_detach_from_object(struct fsnotify_mark *mark)
> +{
> +       struct fsnotify_mark_connector *conn;
> +       struct inode *inode = NULL;
> +
> +       conn = mark->connector;
> +       spin_lock(&conn->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);

I was told that "if {} else ;" is a coding practice that asks for
trouble and I tend to agree,
so please add {} to else case.


> +       mark->connector = NULL;
> +       spin_unlock(&conn->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