linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] ext4: lock i_mutex when truncating orphan inodes
@ 2012-12-27  6:43 Theodore Ts'o
  2012-12-27  6:43 ` [PATCH 2/2] ext4: avoid hang when mounting non-journal filesystems with orphan list Theodore Ts'o
  2012-12-27  7:07 ` [PATCH 1/2] ext4: lock i_mutex when truncating orphan inodes Zheng Liu
  0 siblings, 2 replies; 4+ messages in thread
From: Theodore Ts'o @ 2012-12-27  6:43 UTC (permalink / raw)
  To: Ext4 Developers List; +Cc: Theodore Ts'o, stable

Commit c278531d39f3 added a warning when ext4_flush_unwritten_io() is
called without i_mutex being taken.  It had previously not been taken
during orphan cleanup since races weren't possible at that point in
the mount process, but as a result of this commit, we will now see a
kernel WARN_ON in this case.  Take the i_mutex in
ext4_orphan_cleanup() to suppress this warning.

Reported-by: Alexander Beregalov <a.beregalov@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: stable@vger.kernel.org
---
 fs/ext4/super.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 183ae34..3d4fb81 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -2220,7 +2220,9 @@ static void ext4_orphan_cleanup(struct super_block *sb,
 				__func__, inode->i_ino, inode->i_size);
 			jbd_debug(2, "truncating inode %lu to %lld bytes\n",
 				  inode->i_ino, inode->i_size);
+			mutex_lock(&inode->i_mutex);
 			ext4_truncate(inode);
+			mutex_unlock(&inode->i_mutex);
 			nr_truncates++;
 		} else {
 			ext4_msg(sb, KERN_DEBUG,
-- 
1.7.12.rc0.22.gcdd159b

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-12-27  7:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-27  6:43 [PATCH 1/2] ext4: lock i_mutex when truncating orphan inodes Theodore Ts'o
2012-12-27  6:43 ` [PATCH 2/2] ext4: avoid hang when mounting non-journal filesystems with orphan list Theodore Ts'o
2012-12-27  7:19   ` Zheng Liu
2012-12-27  7:07 ` [PATCH 1/2] ext4: lock i_mutex when truncating orphan inodes Zheng Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).