linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ext4: take i_mutex in ext4_symlink to eliminate a warning from ext4_truncate
@ 2013-03-27 13:19 Zheng Liu
  2013-03-27 13:41 ` Theodore Ts'o
  0 siblings, 1 reply; 14+ messages in thread
From: Zheng Liu @ 2013-03-27 13:19 UTC (permalink / raw)
  To: linux-ext4; +Cc: Zheng Liu

From: Zheng Liu <wenqing.lz@taobao.com>

After applied this commit (8e4061cb), we will get a warning from
ext4_truncate when i_mutex isn't taken.  Here the assumption is that
i_mutex should be taken when we do a truncation.  In ext4_symlink we
could need to call ext4_truncate to trim some blocks beyond i_size, but
the i_mutex isn't taken.

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
---
 fs/ext4/namei.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 3825d6a..d75f91a 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -2856,7 +2856,9 @@ retry:
 		ext4_journal_stop(handle);
 		if (err)
 			goto err_drop_inode;
+		mutex_lock(&inode->i_mutex);
 		err = __page_symlink(inode, symname, l, 1);
+		mutex_unlock(&inode->i_mutex);
 		if (err)
 			goto err_drop_inode;
 		/*
-- 
1.7.12.rc2.18.g61b472e


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

end of thread, other threads:[~2013-04-02  8:19 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-27 13:19 [PATCH] ext4: take i_mutex in ext4_symlink to eliminate a warning from ext4_truncate Zheng Liu
2013-03-27 13:41 ` Theodore Ts'o
2013-03-27 14:02   ` Zheng Liu
2013-03-27 13:51     ` Theodore Ts'o
2013-03-27 15:07       ` Zheng Liu
2013-03-27 15:19         ` Zheng Liu
2013-03-27 15:12           ` Theodore Ts'o
2013-03-27 15:35             ` Zheng Liu
2013-03-28 14:06               ` Theodore Ts'o
2013-04-01 15:23                 ` [PATCH] fs: take i_mutex in __page_symlink() Theodore Ts'o
2013-04-01 16:35                   ` Al Viro
2013-04-01 17:38                     ` Theodore Ts'o
2013-04-02  8:19                   ` Dmitry Monakhov
2013-03-27 14:04     ` [PATCH] ext4: take i_mutex in ext4_symlink to eliminate a warning from ext4_truncate 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).