Whamcloud - gitweb
LU-18471 ldiskfs: large directory causes htree corruption 94/57094/3
authorShaun Tancheff <shaun.tancheff@hpe.com>
Thu, 21 Nov 2024 01:55:54 +0000 (08:55 +0700)
committerOleg Drokin <green@whamcloud.com>
Mon, 2 Dec 2024 05:39:53 +0000 (05:39 +0000)
When creating a lot of files in a single directory, it can
get corrupted because of a typo in ext4-kill-dx-root.patch.

Lustre-change: https://review.whamcloud.com/46526
Lustre-commit: ea3ee9337f9bcd42360e4523f1e34bcd04d3bf41

Test-Parameters: trivial
HPE-bug-id: LUS-12617
Fixes: 8da23f070c ("LU-15544 ldiskfs: SUSE 15 SP4 kernel 5.14.21 SUSE")
Fixes: fc87b01f96 ("LU-12477 ldiskfs: remove obsolete ext4 patches")
Fixes: 89075044b3 ("LU-12477 ldiskfs: drop SUSE kernel 4.4 and earlier")
Signed-off-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Change-Id: Iacbaf9840db76ea7e2e017835a14b476ca9be391
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/57094
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Artem Blagodarenko <ablagodarenko@ddn.com>
Reviewed-by: Andrew Perepechko <andrew.perepechko@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
ldiskfs/kernel_patches/patches/linux-5.14/ext4-kill-dx-root.patch
ldiskfs/kernel_patches/patches/rhel7.6/ext4-kill-dx-root.patch
ldiskfs/kernel_patches/patches/rhel7.7/ext4-large-dir.patch
ldiskfs/kernel_patches/patches/suse15/ext4-kill-dx-root.patch

index 505c7f3..c1ca5a9 100644 (file)
@@ -1,5 +1,15 @@
-Subject: [PATCH] linux-5.14/ext4-kill-dx-root.patch
+removes static definition of dx_root struct. so that "." and ".." dirent can
+have extra data. This patch does not change any functionality but is required for
+ext4_data_in_dirent patch.
 
+Signed-off-by: Bob Glossman <bob.glossman@intel.com>
+Signed-off-by: Yang Sheng <yang.sheng@intel.com>
+Change-Id: Ifbc294a53bd21eb35d373637d3326fc3c611c9f0
+Reviewed-on: http://review.whamcloud.com/10249
+Tested-by: Jenkins
+Tested-by: Maloo <hpdd-maloo@intel.com>
+Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
+Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
 ---
  fs/ext4/namei.c | 119 +++++++++++++++++++++++++-----------------------
  1 file changed, 61 insertions(+), 58 deletions(-)
@@ -251,7 +261,7 @@ index e4514c9..92d29fe 100644
 -                      dxroot->info.indirect_levels += 1;
 +                      info = dx_get_dx_info((struct ext4_dir_entry_2 *)
 +                                            frames[0].bh->b_data);
-+                      info->indirect_levels = 1;
++                      info->indirect_levels += 1;
                        dxtrace(printk(KERN_DEBUG
                                       "Creating %d level index...\n",
                                       dxroot->info.indirect_levels));
index 37caa04..d21cedb 100644 (file)
@@ -1,6 +1,15 @@
 removes static definition of dx_root struct. so that "." and ".." dirent can
 have extra data. This patch does not change any functionality but is required for
 ext4_data_in_dirent patch.
+
+Signed-off-by: Bob Glossman <bob.glossman@intel.com>
+Signed-off-by: Yang Sheng <yang.sheng@intel.com>
+Change-Id: Ifbc294a53bd21eb35d373637d3326fc3c611c9f0
+Reviewed-on: http://review.whamcloud.com/10249
+Tested-by: Jenkins
+Tested-by: Maloo <hpdd-maloo@intel.com>
+Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
+Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
  
 Index: linux-3.10.0-123.9.3.el7.x86_64/fs/ext4/namei.c
 ===================================================================
@@ -241,7 +250,7 @@ Index: linux-3.10.0-123.9.3.el7.x86_64/fs/ext4/namei.c
 -                      ((struct dx_root *) frames[0].bh->b_data)->info.indirect_levels = 1;
 +                      info = dx_get_dx_info((struct ext4_dir_entry_2 *)
 +                                            frames[0].bh->b_data);
-+                      info->indirect_levels = 1;
++                      info->indirect_levels += 1;
  
                        /* Add new access path frame */
                        frame = frames + 1;
index 765fd7e..98ac24e 100644 (file)
@@ -279,12 +279,10 @@ Index: linux-3.10.0-229.1.2.fc21.x86_64/fs/ext4/namei.c
                               icount * sizeof(struct dx_entry));
                        dx_set_limit(entries2, dx_node_limit(dir));
  
-@@ -2224,22 +2267,17 @@ static int ext4_dx_add_entry(handle_t *h
-                       dx_set_block(entries + 0, newblock);
-                       info = dx_get_dx_info((struct ext4_dir_entry_2*)
+@@ -2348,20 +2391,16 @@ static int ext4_dx_add_entry(handle_t *handle, struct dentry *dentry,
                                              frames[0].bh->b_data);
--                      info->indirect_levels = 1;
--
+                       info->indirect_levels += 1;
 -                      /* Add new access path frame */
 -                      frame = frames + 1;
 -                      frame->at = at = at - entries + entries2;
@@ -292,7 +290,6 @@ Index: linux-3.10.0-229.1.2.fc21.x86_64/fs/ext4/namei.c
 -                      frame->bh = bh2;
 -                      err = ext4_journal_get_write_access(handle,
 -                                                           frame->bh);
-+                      info->indirect_levels += 1;
 +                      dxtrace(printk(KERN_DEBUG
 +                                     "Creating %d level index...\n",
 +                                     info->indirect_levels));
index 231f76b..b0bcdf0 100644 (file)
@@ -1,6 +1,15 @@
 removes static definition of dx_root struct. so that "." and ".." dirent can
 have extra data. This patch does not change any functionality but is required for
 ext4_data_in_dirent patch.
+
+Signed-off-by: Bob Glossman <bob.glossman@intel.com>
+Signed-off-by: Yang Sheng <yang.sheng@intel.com>
+Change-Id: Ifbc294a53bd21eb35d373637d3326fc3c611c9f0
+Reviewed-on: http://review.whamcloud.com/10249
+Tested-by: Jenkins
+Tested-by: Maloo <hpdd-maloo@intel.com>
+Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
+Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
  
 Index: linux-3.10.0-123.9.3.el7.x86_64/fs/ext4/namei.c
 ===================================================================
@@ -216,7 +225,7 @@ Index: linux-3.10.0-123.9.3.el7.x86_64/fs/ext4/namei.c
 -                      ((struct dx_root *) frames[0].bh->b_data)->info.indirect_levels = 1;
 +                      info = dx_get_dx_info((struct ext4_dir_entry_2 *)
 +                                            frames[0].bh->b_data);
-+                      info->indirect_levels = 1;
++                      info->indirect_levels += 1;
  
                        /* Add new access path frame */
                        frame = frames + 1;