ocfs2: Fix possible deadlock when extending quota file
PATCH 1/1 ocfs2: Fix possible deadlock when extending quota file
In OCFS2, allocator locks rank above transaction start. Thus we cannot extend quota file from inside a transaction less we could deadlock.
We solve the problem by starting transaction not already in ocfs2_acquire_dquot() but only in ocfs2_local_read_dquot() and ocfs2_global_read_dquot() and we allocate blocks to quota files before starting the transaction. In case we crash, quota files will just have a few blocks more but that's no problem since we just use them next time we extend the quota file.
--- fs/ocfs2/journal.h | 5 -- fs/ocfs2/quota_global.c | 115 +++++++++++++++++++++++------------------------ 2 files changed, 57 insertions(+), 63 deletions(-)
Joel, could you please merge this fix? Thanks.
fs/ocfs2/journal.h +0 -5
@@ -363,11 +363,6 @@ static inline int ocfs2_quota_trans_credits(struct super_block *sb)return credits; } -/* Number of credits needed for removing quota structure from file */ -int ocfs2_calc_qdel_credits (struct super_block *sb,int type); -/* Number of credits needed for initialization of new quota structure */ -int ocfs2_calc_qinit_credits (struct super_block *sb,int type); -/* group extend. inode update and last group update. */ #define OCFS2_GROUP_EXTEND_CREDITS (OCFS2_INODE_UPDATE_CREDITS + 1)
fs/ocfs2/quota_global.c +57 -58
177 lines not on this page · raw message
Signature · 1 line
1.6.0.2
PATCH 1/1 ocfs2: Fix possible deadlock when extending quota file
Quoted 4 lines · Jan Kara
In OCFS2, allocator locks rank above transaction start. Thus we cannot extend quota file from inside a transaction less we could deadlock.
Quoted 8 lines
We solve the problem by starting transaction not already in
ocfs2_acquire_dquot()but only inocfs2_local_read_dquot()andocfs2_global_read_dquot()and we allocate blocks to quota files before starting the transaction. In case we crash, quota files will just have a few blocks more but that's no problem since we just use them next time we extend the quota file.Signed-off-by Jan Kara <[email protected]>
This patch is now in the fixes branch of ocfs2.git.
Joel
Signature · 9 lines
Life's Little Instruction Book #43 "Never give up on somebody. Miracles happen every day." Joel Becker Principal Software Developer Oracle E-mail: joel.becker at oracle.com Phone: (650) 506-8127