Patchwork ext4: Fix deadlock with quota feature

login
register
mail settings
Submitter Jan Kara
Date April 5, 2013, 10:06 a.m.
Message ID <1365156382-16703-1-git-send-email-jack@suse.cz>
Download mbox | patch
Permalink /patch/234095/
State Accepted
Headers show

Comments

Jan Kara - April 5, 2013, 10:06 a.m.
We didn't mark hidden quota files with S_NOQUOTA flag and thus quota was
accounted even for quota files. Thus we could recurse back to quota code
when adding new blocks to quota file which can easily deadlock. Mark
hidden quota files properly.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/ext4/super.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
Theodore Ts'o - April 9, 2013, 1:20 p.m.
On Fri, Apr 05, 2013 at 12:06:22PM +0200, Jan Kara wrote:
> We didn't mark hidden quota files with S_NOQUOTA flag and thus quota was
> accounted even for quota files. Thus we could recurse back to quota code
> when adding new blocks to quota file which can easily deadlock. Mark
> hidden quota files properly.
> 
> Signed-off-by: Jan Kara <jack@suse.cz>

Thanks, applied.

					- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 5d6d535..fc203b3 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -4945,6 +4945,8 @@  static int ext4_quota_enable(struct super_block *sb, int type, int format_id,
 		return PTR_ERR(qf_inode);
 	}
 
+	/* Don't account quota for quota files to avoid recursion */
+	qf_inode->i_flags |= S_NOQUOTA;
 	err = dquot_enable(qf_inode, type, format_id, flags);
 	iput(qf_inode);