summaryrefslogtreecommitdiffstats
path: root/fs/ext4
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2013-04-03 21:58:52 -0400
committerTheodore Ts'o <tytso@mit.edu>2013-04-03 21:58:52 -0400
commit19b5ef615787062a87c4ea15fcdb0e256b62ed19 (patch)
tree4a86242cfd6c9df602ce8ad277495fc6ad190767 /fs/ext4
parent819c4920b7e60ecfd6f0f61d890af4cdf3873d18 (diff)
downloadlinux-19b5ef615787062a87c4ea15fcdb0e256b62ed19.tar.bz2
ext4: add mutex_is_locked() assertion to ext4_truncate()
[ Added fixup from Lukáš Czerner which only checks the assertion when the inode is not new and is not being freed. ] Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/inode.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 49c80e4ac5ac..56ebd662033b 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -3788,6 +3788,13 @@ void ext4_truncate(struct inode *inode)
struct address_space *mapping = inode->i_mapping;
loff_t page_len;
+ /*
+ * There is a possibility that we're either freeing the inode
+ * or it completely new indode. In those cases we might not
+ * have i_mutex locked because it's not necessary.
+ */
+ if (!(inode->i_state & (I_NEW|I_FREEING)))
+ WARN_ON(!mutex_is_locked(&inode->i_mutex));
trace_ext4_truncate_enter(inode);
if (!ext4_can_truncate(inode))