Skip to content

Commit

Permalink
fsnotify: Avoid double locking in fsnotify_detach_from_object()
Browse files Browse the repository at this point in the history
We lock object list lock in fsnotify_detach_from_object() twice - once
to detach mark and second time to recalculate mask. That is unnecessary
and later it will become problematic as we will free the connector as
soon as there is no mark in it. So move recalculation of fsnotify mask
into the same critical section that is detaching mark.

This also removes recalculation of child dentry flags from
fsnotify_detach_from_object(). That is however fine. Those marks will
get recalculated once some event happens on a child.

Reviewed-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
  • Loading branch information
Jan Kara committed Apr 10, 2017
1 parent 8212a60 commit 73cd3c3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/notify/mark.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ static struct inode *fsnotify_detach_from_object(struct fsnotify_mark *mark)
if (conn->flags & FSNOTIFY_OBJ_TYPE_INODE)
inode = conn->inode;
}
__fsnotify_recalc_mask(conn);
mark->connector = NULL;
spin_unlock(lock);
fsnotify_recalc_mask(conn);

return inode;
}
Expand Down

0 comments on commit 73cd3c3

Please sign in to comment.