linux/fs/ocfs2
Junxiao Bi 136f49b917 ocfs2: fix journal commit deadlock
For buffer write, page lock will be got in write_begin and released in
write_end, in ocfs2_write_end_nolock(), before it unlock the page in
ocfs2_free_write_ctxt(), it calls ocfs2_run_deallocs(), this will ask
for the read lock of journal->j_trans_barrier.  Holding page lock and
ask for journal->j_trans_barrier breaks the locking order.

This will cause a deadlock with journal commit threads, ocfs2cmt will
get write lock of journal->j_trans_barrier first, then it wakes up
kjournald2 to do the commit work, at last it waits until done.  To
commit journal, kjournald2 needs flushing data first, it needs get the
cache page lock.

Since some ocfs2 cluster locks are holding by write process, this
deadlock may hung the whole cluster.

unlock pages before ocfs2_run_deallocs() can fix the locking order, also
put unlock before ocfs2_commit_trans() to make page lock is unlocked
before j_trans_barrier to preserve unlocking order.

Signed-off-by: Junxiao Bi <junxiao.bi@oracle.com>
Reviewed-by: Wengang Wang <wen.gang.wang@oracle.com>
Cc: <stable@vger.kernel.org>
Reviewed-by: Mark Fasheh <mfasheh@suse.de>
Cc: Joel Becker <jlbec@evilplan.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-12-18 19:08:11 -08:00
..
cluster ocfs2: o2net: fix connect expired 2014-12-10 17:41:03 -08:00
dlm ocfs2/dlm: fix race between dispatched_work and dlm_lockres_grab_inflight_worker 2014-12-18 19:08:11 -08:00
dlmfs assorted conversions to %p[dD] 2014-11-19 13:01:20 -05:00
acl.c
acl.h
alloc.c ocfs2: reflink: fix slow unlink for refcounted file 2014-12-18 19:08:11 -08:00
alloc.h ocfs2: reflink: fix slow unlink for refcounted file 2014-12-18 19:08:11 -08:00
aops.c ocfs2: fix journal commit deadlock 2014-12-18 19:08:11 -08:00
aops.h
blockcheck.c
blockcheck.h
buffer_head_io.c
buffer_head_io.h
dcache.c assorted conversions to %p[dD] 2014-11-19 13:01:20 -05:00
dcache.h
dir.c ocfs2: reflink: fix slow unlink for refcounted file 2014-12-18 19:08:11 -08:00
dir.h
dlmglue.c Merge branch 'akpm' (patchbomb from Andrew) 2014-12-10 18:34:42 -08:00
dlmglue.h
export.c
export.h
extent_map.c
extent_map.h
file.c ocfs2: reflink: fix slow unlink for refcounted file 2014-12-18 19:08:11 -08:00
file.h
heartbeat.c
heartbeat.h
inode.c ocfs2: remove bogus test from ocfs2_read_locked_inode() 2014-12-10 17:41:03 -08:00
inode.h ocfs2: Convert to private i_dquot field 2014-11-10 10:06:11 +01:00
ioctl.c ocfs2: do not write error flag to user structure we cannot copy from/to 2014-08-29 16:28:16 -07:00
ioctl.h
journal.c vfs: make first argument of dir_context.actor typed 2014-10-31 17:48:54 -04:00
journal.h
Kconfig
localalloc.c
localalloc.h
locks.c
locks.h
Makefile
mmap.c
mmap.h
move_extents.c ocfs2: remove bogus NULL check in ocfs2_move_extents() 2014-12-10 17:41:04 -08:00
move_extents.h
namei.c ocfs2: fix d_splice_alias() return code checking 2014-10-29 16:33:15 -07:00
namei.h
ocfs1_fs_compat.h
ocfs2_fs.h
ocfs2_ioctl.h
ocfs2_lockid.h
ocfs2_lockingver.h
ocfs2_trace.h
ocfs2.h ocfs2: do not set OCFS2_LOCK_UPCONVERT_FINISHING if nonblocking lock can not be granted at once 2014-12-10 17:41:03 -08:00
quota_global.c ocfs2: Don't use MAXQUOTAS value 2014-09-17 11:59:12 +02:00
quota_local.c ocfs2: Don't use MAXQUOTAS value 2014-09-17 11:59:12 +02:00
quota.h ocfs2: Don't use MAXQUOTAS value 2014-09-17 11:59:12 +02:00
refcounttree.c
refcounttree.h
reservations.c
reservations.h
resize.c
resize.h
slot_map.c ocfs2: fix an off-by-one BUG_ON() statement 2014-12-10 17:41:03 -08:00
slot_map.h
stack_o2cb.c
stack_user.c fs/ocfs2/stack_user.c: fix typo in ocfs2_control_release() 2014-10-09 22:25:46 -04:00
stackglue.c
stackglue.h
suballoc.c
suballoc.h
super.c Merge branch 'akpm' (patchbomb from Andrew) 2014-12-10 18:34:42 -08:00
super.h
symlink.c
symlink.h
sysfile.c
sysfile.h
uptodate.c
uptodate.h
xattr.c ocfs2: Fix xattr check in ocfs2_get_xattr_nolock() 2014-12-10 17:41:03 -08:00
xattr.h