[PATCH 0/14] fsnotify: simplify locking

From: Lino Sanfilippo
Date: Wed Jan 19 2011 - 11:45:59 EST


This patchset simplifies some of the locking that is needed to handle the addition and
removal of marks from groups and vfs objects (inodes, mounts). It applies against
commit ef9bf3b7144bee6ce1da5616015cabc8771206af of branch
'origin/for-next' from git.infradead.org/users/eparis/notify.git


The recent locking order used in fsnotify is

mark->lock
group->mark_lock
inode->i_lock

The problem is that we cant use the group->mark_lock to synchronize addition and
removal of marks to/from a group, so we have to use an additional mutex, namely the
group->mutex, for this purpose.
We also need a dedicated kernel thread for mark destruction since we cant call
synchronize() for the mark_srcu with a spinlock held (at least i assume that this
is the main reason this thread exists).

The main goal of these patches is to change the locking order to

group->mark_lock
inode->i_lock
mark->lock

and by this simplify the concerning code:
- use the group->mark_lock for group list iteration and addition/removal of marks
- call synchronize() for mark_srcu as soon as a mark is removed from its
fsobject and thus avoid the need for the "fsnotify_mark" thread
- avoid temporary lists for mark traversal



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/