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-4.15.0/fs/ext4/inode.c
6 ===================================================================
7 --- linux-4.15.0.orig/fs/ext4/inode.c
8 +++ linux-4.15.0/fs/ext4/inode.c
9 @@ -4398,8 +4398,6 @@ int ext4_truncate(struct inode *inode)
10 * or it's a completely new inode. 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(!inode_is_locked(inode));
15 trace_ext4_truncate_enter(inode);
17 if (!ext4_can_truncate(inode))
18 Index: linux-4.15.0/fs/ext4/namei.c
19 ===================================================================
20 --- linux-4.15.0.orig/fs/ext4/namei.c
21 +++ linux-4.15.0/fs/ext4/namei.c
22 @@ -3370,8 +3370,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 - !inode_is_locked(inode));
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 @@ -3452,8 +3450,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 - !inode_is_locked(inode));
37 /* Do this quick check before taking global s_orphan_lock. */
38 if (list_empty(&ei->i_orphan))