summary refs log tree commit diff
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2008-04-29 22:02:07 -0400
committerTheodore Ts'o <tytso@mit.edu>2008-04-29 22:02:07 -0400
commit2887df139c40512cdc147d1a84d95d4f3d261bd1 (patch)
treee42a0ad7c0532f373dc4b09928cd8396bcf4e6dc
parent53b7e9f6807c1274eee19201396b4c2b5f721553 (diff)
downloadlinux-2887df139c40512cdc147d1a84d95d4f3d261bd1.tar.gz
ext4: Fix hang on umount with quotas when journal is aborted
Call dquot_drop() from ext4_dquot_drop() even if we fail to start a
transaction. Otherwise we never get to dropping references to quota structures
from the inode and umount will hang indefinitely.  Thanks to Payphone LIOU for
spotting the problem.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Mingming Cao <cmm@us.ibm.com>
CC: Payphone LIOU <lioupayphone@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>

-rw-r--r--fs/ext4/super.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 93a7e746f425..e3b3483b600d 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3040,8 +3040,14 @@ static int ext4_dquot_drop(struct inode *inode)
 
 	/* We may delete quota structure so we need to reserve enough blocks */
 	handle = ext4_journal_start(inode, 2*EXT4_QUOTA_DEL_BLOCKS(inode->i_sb));
-	if (IS_ERR(handle))
+	if (IS_ERR(handle)) {
+		/*
+		 * We call dquot_drop() anyway to at least release references
+		 * to quota structures so that umount does not hang.
+		 */
+		dquot_drop(inode);
 		return PTR_ERR(handle);
+	}
 	ret = dquot_drop(inode);
 	err = ext4_journal_stop(handle);
 	if (!ret)