1 There will cause a deadlock if invoke ext4_truncate with i_mutex locked
2 in lustre. Since lustre has own lock to provide protect so we don't
3 need this check at all.
5 Index: linux-3.10.0-229.1.2.fc21.x86_64/fs/ext4/inode.c
6 ===================================================================
7 --- linux-3.10.0-229.1.2.fc21.x86_64.orig/fs/ext4/inode.c
8 +++ linux-3.10.0-229.1.2.fc21.x86_64/fs/ext4/inode.c
9 @@ -3644,8 +3644,6 @@ void ext4_truncate(struct inode *inode)
10 * or it completely new indode. In those cases we might not
11 * have i_mutex locked because it's not necessary.
13 - if (!(inode->i_state & (I_NEW|I_FREEING)))
14 - WARN_ON(!mutex_is_locked(&inode->i_mutex));
15 trace_ext4_truncate_enter(inode);
17 if (!ext4_can_truncate(inode))
18 Index: linux-3.10.0-229.1.2.fc21.x86_64/fs/ext4/namei.c
19 ===================================================================
20 --- linux-3.10.0-229.1.2.fc21.x86_64.orig/fs/ext4/namei.c
21 +++ linux-3.10.0-229.1.2.fc21.x86_64/fs/ext4/namei.c
22 @@ -3163,8 +3163,6 @@ int ext4_orphan_add(handle_t *handle, st
23 if (!sbi->s_journal || is_bad_inode(inode))
26 - WARN_ON_ONCE(!(inode->i_state & (I_NEW | I_FREEING)) &&
27 - !mutex_is_locked(&inode->i_mutex));
29 * Exit early if inode already is on orphan list. This is a big speedup
30 * since we don't have to contend on the global s_orphan_lock.
31 @@ -3245,8 +3243,6 @@ int ext4_orphan_del(handle_t *handle, st
32 if (!sbi->s_journal && !(sbi->s_mount_state & EXT4_ORPHAN_FS))
35 - WARN_ON_ONCE(!(inode->i_state & (I_NEW | I_FREEING)) &&
36 - !mutex_is_locked(&inode->i_mutex));
37 /* Do this quick check before taking global s_orphan_lock. */
38 if (list_empty(&ei->i_orphan))