Whamcloud - gitweb
LU-14965 ldiskfs: hold inode mutex for ldiskfs_orphan_add() 54/44754/3
authorBobi Jam <bobijam@whamcloud.com>
Thu, 26 Aug 2021 10:19:11 +0000 (18:19 +0800)
committerOleg Drokin <green@whamcloud.com>
Fri, 17 Sep 2021 14:10:04 +0000 (14:10 +0000)
See following warning:

ldiskfs/namei.c:3331 ldiskfs_orphan_add+0x11e/0x290 [ldiskfs]
Call Trace:
dump_stack+0x19/0x1b
__warn+0xd8/0x100
warn_slowpath_null+0x1d/0x20
ldiskfs_orphan_add+0x11e/0x290 [ldiskfs]
ldiskfs_xattr_inode_orphan_add+0xbb/0x110 [ldiskfs]
ldiskfs_xattr_delete_inode+0x5c/0x350 [ldiskfs]
ldiskfs_evict_inode+0x1a8/0x630 [ldiskfs]
evict+0xb4/0x180
iput+0xfc/0x190
osd_object_delete+0x1f8/0x370 [osd_ldiskfs]
lu_object_free.isra.27+0xb8/0x1c0 [obdclass]
lu_object_put+0xa5/0x460 [obdclass]
mdt_object_put+0x30/0x110 [mdt]
mdt_reint_unlink+0x8e0/0x1890 [mdt]
mdt_reint_rec+0x83/0x210 [mdt]
mdt_reint_internal+0x720/0xaf0 [mdt]
mdt_reint+0x67/0x140 [mdt]
tgt_request_handle+0x7ea/0x1750 [ptlrpc]
ptlrpc_server_handle_request+0x256/0xb10 [ptlrpc]
ptlrpc_main+0xb3c/0x14e0 [ptlrpc]
kthread+0xd1/0xe0
ret_from_fork_nospec_begin+0x21/0x21

Need to hold inode mutex on the external EA for ldiskfs_orphan_add()
to soothe the warning.

Fixes: f64e9f19f68e ("LU-12977 ldiskfs: properly take inode_lock() for truncates")
Signed-off-by: Bobi Jam <bobijam@whamcloud.com>
Change-Id: I3a1abfde3289c0bbd46e0d5a5b9d2ff7d7cf9273
Reviewed-on: https://review.whamcloud.com/44754
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
ldiskfs/kernel_patches/patches/rhel7.7/ext4-large-eas.patch

index b8148e0..239e1f6 100644 (file)
@@ -783,7 +783,7 @@ Index: linux-stage/fs/ext4/xattr.c
                        new_offs = le16_to_cpu(last->e_value_offs) +
                                                        value_offs_shift;
                        BUG_ON(new_offs + le32_to_cpu(last->e_value_size)
                        new_offs = le16_to_cpu(last->e_value_offs) +
                                                        value_offs_shift;
                        BUG_ON(new_offs + le32_to_cpu(last->e_value_size)
-@@ -1494,21 +1835,140 @@ cleanup:
+@@ -1496,21 +1840,142 @@ cleanup:
  }
  
  
  }
  
  
@@ -860,7 +860,9 @@ Index: linux-stage/fs/ext4/xattr.c
 +                              lea_ino_array->xia_inodes[idx], &error);
 +              if (error)
 +                      continue;
 +                              lea_ino_array->xia_inodes[idx], &error);
 +              if (error)
 +                      continue;
++              inode_lock(ea_inode);
 +              ext4_orphan_add(handle, ea_inode);
 +              ext4_orphan_add(handle, ea_inode);
++              inode_unlock(ea_inode);
 +              /* the inode's i_count will be released by caller */
 +      }
 +
 +              /* the inode's i_count will be released by caller */
 +      }
 +