[PATCH] ext4: take i_mutex in ext4_symlink to eliminate a warning from ext4_truncate

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Zheng Liu <wenqing.lz@xxxxxxxxxx>

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@xxxxxxxxxx>
---
 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

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




[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux