Whamcloud - gitweb
LU-14965 ldiskfs: rhel7.6 inode mutex for ldiskfs_orphan_add 65/45165/2
authorBobi Jam <bobijam@whamcloud.com>
Fri, 8 Oct 2021 09:21:22 +0000 (16:21 +0700)
committerOleg Drokin <green@whamcloud.com>
Thu, 23 Dec 2021 07:18:37 +0000 (07:18 +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.

This is a port of:

Lustre-commit: 7d3b5d9fdc766411eacaed27fb2fd9250800f096
Lustre-change: https://review.whamcloud.com/44754

Test-Parameters: trivial
Fixes: f64e9f19f68e ("LU-12977 ldiskfs: properly take inode_lock() for truncates")
Signed-off-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Change-Id: I47a01862793afaac1d7c311f1b6d65d2cf4bb93f
Reviewed-on: https://review.whamcloud.com/45165
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andrew Perepechko <andrew.perepechko@hpe.com>
Reviewed-by: Alexander Zarochentsev <alexander.zarochentsev@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
ldiskfs/kernel_patches/patches/rhel7.6/ext4-large-eas.patch

index 9703ad1..633e73a 100644 (file)
@@ -11,9 +11,9 @@ Subject: [PATCH] This patch implements the large EA support in ext4. If the
  fs/ext4/indirect.c |   3 +-
  fs/ext4/inline.c   |   2 +-
  fs/ext4/inode.c    |  45 +++-
- fs/ext4/xattr.c    | 605 ++++++++++++++++++++++++++++++++++++++++++---
+ fs/ext4/xattr.c    | 607 ++++++++++++++++++++++++++++++++++++++++++---
  fs/ext4/xattr.h    |  33 ++-
- 8 files changed, 645 insertions(+), 53 deletions(-)
+ 8 files changed, 647 insertions(+), 53 deletions(-)
 
 diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
 index ba54a96..e28bcdb 100644
@@ -199,7 +199,7 @@ index 6c6ac63..2086792 100644
  {
        ext4_group_t groups, ngroups = ext4_get_groups_count(inode->i_sb);
 diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
-index c10e37f..2288410 100644
+index c10e37f..88e8579 100644
 --- a/fs/ext4/xattr.c
 +++ b/fs/ext4/xattr.c
 @@ -201,6 +201,7 @@ ext4_xattr_check_names(struct ext4_xattr_entry *entry, void *end,
@@ -824,7 +824,7 @@ index c10e37f..2288410 100644
                        new_offs = le16_to_cpu(last->e_value_offs) +
                                                        value_offs_shift;
                        BUG_ON(new_offs + le32_to_cpu(last->e_value_size)
-@@ -1469,21 +1813,140 @@ cleanup:
+@@ -1469,21 +1813,142 @@ cleanup:
  }
  
  
@@ -901,7 +901,9 @@ index c10e37f..2288410 100644
 +                              lea_ino_array->xia_inodes[idx], &error);
 +              if (error)
 +                      continue;
++              inode_lock(ea_inode);
 +              ext4_orphan_add(handle, ea_inode);
++              inode_unlock(ea_inode);
 +              /* the inode's i_count will be released by caller */
 +      }
 +
@@ -970,7 +972,7 @@ index c10e37f..2288410 100644
        bh = sb_bread(inode->i_sb, EXT4_I(inode)->i_file_acl);
        if (!bh) {
                EXT4_ERROR_INODE(inode, "block %llu read error",
-@@ -1496,11 +1959,78 @@ ext4_xattr_delete_inode(handle_t *handle, struct inode *inode)
+@@ -1496,11 +1961,78 @@ ext4_xattr_delete_inode(handle_t *handle, struct inode *inode)
                                 EXT4_I(inode)->i_file_acl);
                goto cleanup;
        }
@@ -1049,7 +1051,7 @@ index c10e37f..2288410 100644
  }
  
  /*
-@@ -1570,10 +2100,9 @@ ext4_xattr_cmp(struct ext4_xattr_header *header1,
+@@ -1570,10 +2102,9 @@ ext4_xattr_cmp(struct ext4_xattr_header *header1,
                    entry1->e_name_index != entry2->e_name_index ||
                    entry1->e_name_len != entry2->e_name_len ||
                    entry1->e_value_size != entry2->e_value_size ||
@@ -1061,7 +1063,7 @@ index c10e37f..2288410 100644
                if (memcmp((char *)header1 + le16_to_cpu(entry1->e_value_offs),
                           (char *)header2 + le16_to_cpu(entry2->e_value_offs),
                           le32_to_cpu(entry1->e_value_size)))
-@@ -1657,7 +2186,7 @@ static inline void ext4_xattr_hash_entry(struct ext4_xattr_header *header,
+@@ -1657,7 +2188,7 @@ static inline void ext4_xattr_hash_entry(struct ext4_xattr_header *header,
                       *name++;
        }