From: Jadhav Vikram Date: Wed, 3 Feb 2021 15:24:31 +0000 (+0800) Subject: LU-9510 ldiskfs: to not verify preallocation in umount path X-Git-Tag: 2.14.55~26 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;ds=sidebyside;h=9059a1de8913a6e81ada3f20080af0e18e4b498e;hp=90dab62d635666001b8b4e2b7aa8cc1f23bc6f5b;p=fs%2Flustre-release.git LU-9510 ldiskfs: to not verify preallocation in umount path At umount time while discarding inode preallocation space, panic occurred due to mismatch found in preallocation space free blocks i.e pa->pa_free and free blocks calculated by reading on disk block bitmap within preallocation space length. Similar crash will occur when user sets errors=panic in mount option and if there is mismatch in pa space free blocks. Changes added to not verify mismatch in disk and in-memory preallocated space unused blocks if the file system is being umounted. Seagate-bug-id: MRP-3741 Signed-off-by: Jadhav Vikram Signed-off-by: Jadhav Vikram Reviewed-by: Alexey Leonidovich Lyashkov Reviewed-by: Ashish Purkar Tested-by: Elena V. Gryaznova Change-Id: I6d43905d49a219d1a5b966ab405e974a1f29b2f3 Reviewed-on: https://review.whamcloud.com/27130 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Alex Zhuravlev --- diff --git a/ldiskfs/kernel_patches/patches/rhel7.6/ext4-corrupted-inode-block-bitmaps-handling-patches.patch b/ldiskfs/kernel_patches/patches/rhel7.6/ext4-corrupted-inode-block-bitmaps-handling-patches.patch index 26a0f6e..31cbc2d 100644 --- a/ldiskfs/kernel_patches/patches/rhel7.6/ext4-corrupted-inode-block-bitmaps-handling-patches.patch +++ b/ldiskfs/kernel_patches/patches/rhel7.6/ext4-corrupted-inode-block-bitmaps-handling-patches.patch @@ -240,9 +240,9 @@ Index: linux-stage/fs/ext4/mballoc.c } return 0; @@ -3961,16 +3972,8 @@ ext4_mb_release_inode_pa(struct ext4_bud - /* "free < pa->pa_free" means we maybe double alloc the same blocks, * otherwise maybe leave some free blocks unavailable, no need to BUG.*/ - if ((free > pa->pa_free && !pa->pa_error) || (free < pa->pa_free)) { + if (((free > pa->pa_free && !pa->pa_error) || (free < pa->pa_free)) && + atomic_read(&sb->s_active) > 0) { - ext4_error(sb, "pa free mismatch: [pa %p] " - "[phy %lu] [logic %lu] [len %u] [free %u] " - "[error %u] [inode %lu] [freed %u]", pa, diff --git a/ldiskfs/kernel_patches/patches/rhel7.6/ext4-mballoc-pa-free-mismatch.patch b/ldiskfs/kernel_patches/patches/rhel7.6/ext4-mballoc-pa-free-mismatch.patch index a8aad4a..1e4fdeb 100644 --- a/ldiskfs/kernel_patches/patches/rhel7.6/ext4-mballoc-pa-free-mismatch.patch +++ b/ldiskfs/kernel_patches/patches/rhel7.6/ext4-mballoc-pa-free-mismatch.patch @@ -28,7 +28,7 @@ Index: linux-3.10.0-123.13.2.el7.x86_64/fs/ext4/mballoc.c ext4_get_group_no_and_offset(sb, pa->pa_pstart, &group, &bit); grp_blk_start = pa->pa_pstart - EXT4_C2B(sbi, bit); BUG_ON(group != e4b->bd_group && pa->pa_len != 0); -@@ -3891,12 +3895,18 @@ ext4_mb_release_inode_pa(struct ext4_bud +@@ -3891,12 +3895,19 @@ ext4_mb_release_inode_pa(struct ext4_bud mb_free_blocks(pa->pa_inode, e4b, bit, next - bit); bit = next + 1; } @@ -41,7 +41,8 @@ Index: linux-3.10.0-123.13.2.el7.x86_64/fs/ext4/mballoc.c + + /* "free < pa->pa_free" means we maybe double alloc the same blocks, + * otherwise maybe leave some free blocks unavailable, no need to BUG.*/ -+ if ((free > pa->pa_free && !pa->pa_error) || (free < pa->pa_free)) { ++ if (((free > pa->pa_free && !pa->pa_error) || (free < pa->pa_free)) && ++ atomic_read(&sb->s_active) > 0) { + ext4_error(sb, "pa free mismatch: [pa %p] " + "[phy %lu] [logic %lu] [len %u] [free %u] " + "[error %u] [inode %lu] [freed %u]", pa, @@ -58,7 +59,7 @@ Index: linux-3.10.0-123.13.2.el7.x86_64/fs/ext4/mballoc.c */ } + /* do not verify if the file system is being umounted */ -+ BUG_ON(atomic_read(&sb->s_active) > 0 && pa->pa_free != free); ++ BUG_ON(pa->pa_free != free && atomic_read(&sb->s_active) > 0); atomic_add(free, &sbi->s_mb_discarded); return err; diff --git a/ldiskfs/kernel_patches/patches/rhel8.3/ext4-corrupted-inode-block-bitmaps-handling-patches.patch b/ldiskfs/kernel_patches/patches/rhel8.3/ext4-corrupted-inode-block-bitmaps-handling-patches.patch index 4a7c33e..a3b2627 100644 --- a/ldiskfs/kernel_patches/patches/rhel8.3/ext4-corrupted-inode-block-bitmaps-handling-patches.patch +++ b/ldiskfs/kernel_patches/patches/rhel8.3/ext4-corrupted-inode-block-bitmaps-handling-patches.patch @@ -124,9 +124,9 @@ Index: linux-4.18.0-240.1.1.el8/fs/ext4/mballoc.c } return 0; @@ -4037,16 +4044,8 @@ ext4_mb_release_inode_pa(struct ext4_bud - /* "free < pa->pa_free" means we maybe double alloc the same blocks, * otherwise maybe leave some free blocks unavailable, no need to BUG.*/ - if ((free > pa->pa_free && !pa->pa_error) || (free < pa->pa_free)) { + if (((free > pa->pa_free && !pa->pa_error) || (free < pa->pa_free)) && + atomic_read(&sb->s_active) > 0) { - ext4_error(sb, "pa free mismatch: [pa %p] " - "[phy %lu] [logic %lu] [len %u] [free %u] " - "[error %u] [inode %lu] [freed %u]", pa, diff --git a/ldiskfs/kernel_patches/patches/rhel8/ext4-corrupted-inode-block-bitmaps-handling-patches.patch b/ldiskfs/kernel_patches/patches/rhel8/ext4-corrupted-inode-block-bitmaps-handling-patches.patch index 38e1862..a9b02c7 100644 --- a/ldiskfs/kernel_patches/patches/rhel8/ext4-corrupted-inode-block-bitmaps-handling-patches.patch +++ b/ldiskfs/kernel_patches/patches/rhel8/ext4-corrupted-inode-block-bitmaps-handling-patches.patch @@ -124,9 +124,9 @@ Index: linux-4.18.0-80.1.2.el8_0/fs/ext4/mballoc.c } return 0; @@ -4016,16 +4023,8 @@ ext4_mb_release_inode_pa(struct ext4_bud - /* "free < pa->pa_free" means we maybe double alloc the same blocks, * otherwise maybe leave some free blocks unavailable, no need to BUG.*/ - if ((free > pa->pa_free && !pa->pa_error) || (free < pa->pa_free)) { + if (((free > pa->pa_free && !pa->pa_error) || (free < pa->pa_free)) && + atomic_read(&sb->s_active) > 0) { - ext4_error(sb, "pa free mismatch: [pa %p] " - "[phy %lu] [logic %lu] [len %u] [free %u] " - "[error %u] [inode %lu] [freed %u]", pa, diff --git a/ldiskfs/kernel_patches/patches/ubuntu18/ext4-corrupted-inode-block-bitmaps-handling-patches-001.patch b/ldiskfs/kernel_patches/patches/ubuntu18/ext4-corrupted-inode-block-bitmaps-handling-patches-001.patch index 8eb7add..91c1b46 100644 --- a/ldiskfs/kernel_patches/patches/ubuntu18/ext4-corrupted-inode-block-bitmaps-handling-patches-001.patch +++ b/ldiskfs/kernel_patches/patches/ubuntu18/ext4-corrupted-inode-block-bitmaps-handling-patches-001.patch @@ -241,9 +241,9 @@ Index: linux-4.15.0/fs/ext4/mballoc.c } return 0; @@ -4052,16 +4063,8 @@ ext4_mb_release_inode_pa(struct ext4_bud - /* "free < pa->pa_free" means we maybe double alloc the same blocks, * otherwise maybe leave some free blocks unavailable, no need to BUG.*/ - if ((free > pa->pa_free && !pa->pa_error) || (free < pa->pa_free)) { + if (((free > pa->pa_free && !pa->pa_error) || (free < pa->pa_free)) && + atomic_read(&sb->s_active) > 0) { - ext4_error(sb, "pa free mismatch: [pa %p] " - "[phy %lu] [logic %lu] [len %u] [free %u] " - "[error %u] [inode %lu] [freed %u]", pa, diff --git a/ldiskfs/kernel_patches/patches/ubuntu18/ext4-corrupted-inode-block-bitmaps-handling-patches.patch b/ldiskfs/kernel_patches/patches/ubuntu18/ext4-corrupted-inode-block-bitmaps-handling-patches.patch index 526e8e9..9062641 100644 --- a/ldiskfs/kernel_patches/patches/ubuntu18/ext4-corrupted-inode-block-bitmaps-handling-patches.patch +++ b/ldiskfs/kernel_patches/patches/ubuntu18/ext4-corrupted-inode-block-bitmaps-handling-patches.patch @@ -280,9 +280,9 @@ Index: linux-4.15.0/fs/ext4/mballoc.c } return 0; @@ -4052,16 +4063,8 @@ ext4_mb_release_inode_pa(struct ext4_bud - /* "free < pa->pa_free" means we maybe double alloc the same blocks, * otherwise maybe leave some free blocks unavailable, no need to BUG.*/ - if ((free > pa->pa_free && !pa->pa_error) || (free < pa->pa_free)) { + if (((free > pa->pa_free && !pa->pa_error) || (free < pa->pa_free)) && + atomic_read(&sb->s_active) > 0) { - ext4_error(sb, "pa free mismatch: [pa %p] " - "[phy %lu] [logic %lu] [len %u] [free %u] " - "[error %u] [inode %lu] [freed %u]", pa,