diff options
author | Junxiao Bi <junxiao.bi@oracle.com> | 2014-12-18 16:17:37 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-18 19:08:11 -0800 |
commit | 136f49b9171074872f2a14ad0ab10486d1ba13ca (patch) | |
tree | 5ae9acaaa409866aae0308d6507e571756446b22 /fs/ocfs2/quota_local.c | |
parent | 1e5895816030eaadb952c89eb9f4054e5c0082c3 (diff) | |
download | linux-136f49b9171074872f2a14ad0ab10486d1ba13ca.tar.gz linux-136f49b9171074872f2a14ad0ab10486d1ba13ca.tar.bz2 linux-136f49b9171074872f2a14ad0ab10486d1ba13ca.zip |
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>
Diffstat (limited to 'fs/ocfs2/quota_local.c')
0 files changed, 0 insertions, 0 deletions