提交 73cd3c33 编写于 作者: J Jan Kara

fsnotify: Avoid double locking in fsnotify_detach_from_object()

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: NMiklos Szeredi <mszeredi@redhat.com>
Signed-off-by: NJan Kara <jack@suse.cz>
上级 8212a609
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册