linux/fs/gfs2
Jeff Layton 1c8c601a8c locks: protect most of the file_lock handling with i_lock
Having a global lock that protects all of this code is a clear
scalability problem. Instead of doing that, move most of the code to be
protected by the i_lock instead. The exceptions are the global lists
that the ->fl_link sits on, and the ->fl_block list.

->fl_link is what connects these structures to the
global lists, so we must ensure that we hold those locks when iterating
over or updating these lists.

Furthermore, sound deadlock detection requires that we hold the
blocked_list state steady while checking for loops. We also must ensure
that the search and update to the list are atomic.

For the checking and insertion side of the blocked_list, push the
acquisition of the global lock into __posix_lock_file and ensure that
checking and update of the  blocked_list is done without dropping the
lock in between.

On the removal side, when waking up blocked lock waiters, take the
global lock before walking the blocked list and dequeue the waiters from
the global list prior to removal from the fl_block list.

With this, deadlock detection should be race free while we minimize
excessive file_lock_lock thrashing.

Finally, in order to avoid a lock inversion problem when handling
/proc/locks output we must ensure that manipulations of the fl_block
list are also protected by the file_lock_lock.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29 12:57:42 +04:00
..
acl.c gfs2: Use uid_eq and gid_eq where appropriate 2013-02-13 06:15:10 -08:00
acl.h fs: take the ACL checks to common code 2011-07-25 14:30:23 -04:00
aops.c aio: don't include aio.h in sched.h 2013-05-07 20:16:25 -07:00
bmap.c GFS2: Increase i_writecount during gfs2_setattr_size 2013-06-03 16:38:58 +01:00
bmap.h GFS2: New truncate sequence 2010-09-20 11:18:16 +01:00
dentry.c Don't pass inode to ->d_hash() and ->d_compare() 2013-06-29 12:57:36 +04:00
dir.c [readdir] convert gfs2 2013-06-29 12:56:35 +04:00
dir.h [readdir] convert gfs2 2013-06-29 12:56:35 +04:00
export.c [readdir] constify ->actor 2013-06-29 12:57:05 +04:00
file.c locks: protect most of the file_lock handling with i_lock 2013-06-29 12:57:42 +04:00
gfs2.h
glock.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-3.0-nmw 2013-04-30 11:27:14 -07:00
glock.h GFS2: Remove gfs2_refresh_inode from inode creation path 2013-04-08 08:40:17 +01:00
glops.c GFS2: Add origin indicator to glock callbacks 2013-04-10 10:26:55 +01:00
glops.h GFS2: Fix AIL flush issue during fsync 2011-10-21 12:39:41 +01:00
incore.h GFS2: Add origin indicator to glock callbacks 2013-04-10 10:26:55 +01:00
inode.c GFS2: Don't cache iopen glocks 2013-06-03 16:40:22 +01:00
inode.h GFS2: Remove unused argument from gfs2_internal_read 2012-04-24 16:44:37 +01:00
Kconfig GFS2: fix DLM depends to fix build errors 2013-05-24 13:47:53 +01:00
lock_dlm.c GFS2: use memchr_inv 2013-04-04 09:52:50 +01:00
log.c GFS2: replace gfs2_ail structure with gfs2_trans 2013-04-08 08:46:22 +01:00
log.h GFS2: Use ->writepages for ordered writes 2013-01-29 10:29:17 +00:00
lops.c GFS2: Set log descriptor type for jdata blocks 2013-06-03 16:38:39 +01:00
lops.h GFS2: replace gfs2_ail structure with gfs2_trans 2013-04-08 08:46:22 +01:00
main.c GFS2: Fold quota data into the reservations struct 2012-06-06 11:20:22 +01:00
Makefile GFS2: Rename ops_inode.c to inode.c 2011-05-10 13:12:49 +01:00
meta_io.c GFS2: replace gfs2_ail structure with gfs2_trans 2013-04-08 08:46:22 +01:00
meta_io.h GFS2: Merge gfs2_attach_bufdata() into trans.c 2013-01-29 10:28:44 +00:00
ops_fstype.c fs: Limit sys_mount to only request filesystem modules. 2013-03-03 19:36:31 -08:00
quota.c GFS2: two minor quota fixups 2013-05-24 13:47:13 +01:00
quota.h gfs2: Use kuid_t and kgid_t types where appropriate. 2013-02-13 06:15:09 -08:00
recovery.c GFS2: fail mount if journal recovery fails 2012-01-11 09:24:48 +00:00
recovery.h gfs2: use workqueue instead of slow-work 2010-07-23 13:14:25 +02:00
rgrp.c GFS2: Increase i_writecount during gfs2_setattr_size 2013-06-03 16:38:58 +01:00
rgrp.h GFS2: Remove vestigial parameter ip from function rs_deltree 2013-04-08 08:41:04 +01:00
super.c GFS2: Don't cache iopen glocks 2013-06-03 16:40:22 +01:00
super.h GFS2: Clean up freeze code 2013-01-29 10:29:05 +00:00
sys.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-02-26 20:16:07 -08:00
sys.h GFS2: dlm based recovery coordination 2012-01-11 09:23:05 +00:00
trace_gfs2.h GFS2: Add origin indicator to glock demote tracing 2013-04-10 10:32:05 +01:00
trans.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-3.0-nmw 2013-04-30 11:27:14 -07:00
trans.h GFS2: Split gfs2_trans_add_bh() into two 2013-01-29 10:28:04 +00:00
util.c GFS2: Reinstate withdraw ack system 2013-02-13 12:21:40 +00:00
util.h GFS2: Fix error handling when reading an invalid block from the journal 2012-06-06 11:27:49 +01:00
xattr.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace 2013-02-25 16:00:49 -08:00
xattr.h sanitize xattr handler prototypes 2009-12-16 12:16:49 -05:00