aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/quota_global.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2009-06-02 08:23:59 -0400
committerJoel Becker <joel.becker@oracle.com>2009-06-03 22:14:28 -0400
commit4e8a301929bfa017e6ffe11e3cf78ccaf8492801 (patch)
tree5532a7eeb2c1f7d9a52aa663fb6b53677ef0f2b2 /fs/ocfs2/quota_global.c
parent2b53bc7bff17341d8b5ac12115f5c2363638e628 (diff)
ocfs2: Fix possible deadlock in ocfs2_global_read_dquot()
It is not possible to get a read lock and then try to get the same write lock in one thread as that can block on downconvert being requested by other node leading to deadlock. So first drop the quota lock for reading and only after that get it for writing. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/ocfs2/quota_global.c')
-rw-r--r--fs/ocfs2/quota_global.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c
index 1ed0f7c86869..edfa60cd155c 100644
--- a/fs/ocfs2/quota_global.c
+++ b/fs/ocfs2/quota_global.c
@@ -421,6 +421,7 @@ int ocfs2_global_read_dquot(struct dquot *dquot)
421 OCFS2_DQUOT(dquot)->dq_originodes = dquot->dq_dqb.dqb_curinodes; 421 OCFS2_DQUOT(dquot)->dq_originodes = dquot->dq_dqb.dqb_curinodes;
422 if (!dquot->dq_off) { /* No real quota entry? */ 422 if (!dquot->dq_off) { /* No real quota entry? */
423 /* Upgrade to exclusive lock for allocation */ 423 /* Upgrade to exclusive lock for allocation */
424 ocfs2_qinfo_unlock(info, 0);
424 err = ocfs2_qinfo_lock(info, 1); 425 err = ocfs2_qinfo_lock(info, 1);
425 if (err < 0) 426 if (err < 0)
426 goto out_qlock; 427 goto out_qlock;
@@ -435,7 +436,8 @@ int ocfs2_global_read_dquot(struct dquot *dquot)
435out_qlock: 436out_qlock:
436 if (ex) 437 if (ex)
437 ocfs2_qinfo_unlock(info, 1); 438 ocfs2_qinfo_unlock(info, 1);
438 ocfs2_qinfo_unlock(info, 0); 439 else
440 ocfs2_qinfo_unlock(info, 0);
439out: 441out:
440 if (err < 0) 442 if (err < 0)
441 mlog_errno(err); 443 mlog_errno(err);