]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - src/patches/suse-2.6.27.31/patches.fixes/ocfs2-1.4-git-4e8a301929bfa017e6ffe11e3cf78ccaf8492801
Merge branch 'master' of git://git.ipfire.org/ipfire-2.x
[people/teissler/ipfire-2.x.git] / src / patches / suse-2.6.27.31 / patches.fixes / ocfs2-1.4-git-4e8a301929bfa017e6ffe11e3cf78ccaf8492801
1 From: Jan Kara <jack@suse.cz>
2 Subject: ocfs2: Fix possible deadlock in ocfs2_global_read_dquot()
3 Patch-mainline: 2.6.31
4
5 It is not possible to get a read lock and then try to get the same write lock
6 in one thread as that can block on downconvert being requested by other node
7 leading to deadlock. So first drop the quota lock for reading and only after
8 that get it for writing.
9
10 Signed-off-by: Jan Kara <jack@suse.cz>
11 ---
12 fs/ocfs2/quota_global.c | 4 +++-
13 1 file changed, 3 insertions(+), 1 deletion(-)
14
15 --- a/fs/ocfs2/quota_global.c
16 +++ b/fs/ocfs2/quota_global.c
17 @@ -354,6 +354,7 @@ int ocfs2_global_read_dquot(struct dquot
18 OCFS2_DQUOT(dquot)->dq_originodes = dquot->dq_dqb.dqb_curinodes;
19 if (!dquot->dq_off) { /* No real quota entry? */
20 /* Upgrade to exclusive lock for allocation */
21 + ocfs2_qinfo_unlock(info, 0);
22 err = ocfs2_qinfo_lock(info, 1);
23 if (err < 0)
24 goto out_qlock;
25 @@ -368,7 +369,8 @@ int ocfs2_global_read_dquot(struct dquot
26 out_qlock:
27 if (ex)
28 ocfs2_qinfo_unlock(info, 1);
29 - ocfs2_qinfo_unlock(info, 0);
30 + else
31 + ocfs2_qinfo_unlock(info, 0);
32 out:
33 if (err < 0)
34 mlog_errno(err);