From 945fd61b80f22a4148c4c0953ddc4dfcd75337de Mon Sep 17 00:00:00 2001 From: Yang Sheng Date: Thu, 27 Apr 2017 14:48:22 +0800 Subject: [PATCH] LU-8364 ldiskfs: fixes for failover mode Port failover mode patches to other distro and fix failure path in replay patch. Signed-off-by: Yang Sheng Change-Id: I51f5ca0b906a3cbd7554fabb8b447cda4096c781 Reviewed-on: https://review.whamcloud.com/26854 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Bob Glossman Reviewed-by: Niu Yawei Reviewed-by: Oleg Drokin --- .../rhel6.3/ext4-dont-check-before-replay.patch | 2 +- .../rhel7.2/ext4-dont-check-before-replay.patch | 2 +- .../sles11sp3/ext4-dont-check-before-replay.patch | 31 +++++++++++++++++++ .../sles12sp2/ext4-dont-check-before-replay.patch | 35 ++++++++++++++++++++++ .../series/ldiskfs-3.0-sles11sp3.series | 2 ++ .../series/ldiskfs-4.4-sles12sp2.series | 2 ++ 6 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 ldiskfs/kernel_patches/patches/sles11sp3/ext4-dont-check-before-replay.patch create mode 100644 ldiskfs/kernel_patches/patches/sles12sp2/ext4-dont-check-before-replay.patch diff --git a/ldiskfs/kernel_patches/patches/rhel6.3/ext4-dont-check-before-replay.patch b/ldiskfs/kernel_patches/patches/rhel6.3/ext4-dont-check-before-replay.patch index e0af295..57bf9fe 100644 --- a/ldiskfs/kernel_patches/patches/rhel6.3/ext4-dont-check-before-replay.patch +++ b/ldiskfs/kernel_patches/patches/rhel6.3/ext4-dont-check-before-replay.patch @@ -24,7 +24,7 @@ journal replay. no_journal: + if (!ext4_check_descriptors(sb, &first_not_zeroed)) { + ext4_msg(sb, KERN_ERR, "group descriptors corrupted!"); -+ goto failed_mount2; ++ goto failed_mount_wq; + } if (test_opt(sb, NOBH)) { if (!(test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_WRITEBACK_DATA)) { diff --git a/ldiskfs/kernel_patches/patches/rhel7.2/ext4-dont-check-before-replay.patch b/ldiskfs/kernel_patches/patches/rhel7.2/ext4-dont-check-before-replay.patch index 9fb9fa1..de1b7f6 100644 --- a/ldiskfs/kernel_patches/patches/rhel7.2/ext4-dont-check-before-replay.patch +++ b/ldiskfs/kernel_patches/patches/rhel7.2/ext4-dont-check-before-replay.patch @@ -25,7 +25,7 @@ journal replay. + + if (!ext4_check_descriptors(sb, &first_not_zeroed)) { + ext4_msg(sb, KERN_ERR, "group descriptors corrupted!"); -+ goto failed_mount2; ++ goto failed_mount_wq; + } + /* diff --git a/ldiskfs/kernel_patches/patches/sles11sp3/ext4-dont-check-before-replay.patch b/ldiskfs/kernel_patches/patches/sles11sp3/ext4-dont-check-before-replay.patch new file mode 100644 index 0000000..6357ec5 --- /dev/null +++ b/ldiskfs/kernel_patches/patches/sles11sp3/ext4-dont-check-before-replay.patch @@ -0,0 +1,31 @@ +Index: linux-stage/fs/ext4/super.c +When ldiskfs run in failover mode whith read-only disk. +Part of allocation updates are lost and ldiskfs may fail +while mounting this is due to inconsistent state of +group-descriptor. Group-descriptor check is added after +journal replay. +=================================================================== +--- linux-stage/fs/ext4/super.c 2016-11-24 20:50:46.736527130 +0530 ++++ linux-stage.orig/fs/ext4/super.c 2016-11-24 20:54:14.941779453 +0530 +@@ -3429,10 +3429,6 @@ + goto failed_mount2; + } + } +- if (!ext4_check_descriptors(sb, &first_not_zeroed)) { +- ext4_msg(sb, KERN_ERR, "group descriptors corrupted!"); +- goto failed_mount2; +- } + if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_FLEX_BG)) + if (!ext4_fill_flex_info(sb)) { + ext4_msg(sb, KERN_ERR, +@@ -3609,6 +3605,10 @@ + sbi->s_journal->j_commit_callback = ext4_journal_commit_callback; + + no_journal: ++ if (!ext4_check_descriptors(sb, &first_not_zeroed)) { ++ ext4_msg(sb, KERN_ERR, "group descriptors corrupted!"); ++ goto failed_mount_wq; ++ } + /* + * The maximum number of concurrent works can be high and + * concurrency isn't really necessary. Limit it to 1. diff --git a/ldiskfs/kernel_patches/patches/sles12sp2/ext4-dont-check-before-replay.patch b/ldiskfs/kernel_patches/patches/sles12sp2/ext4-dont-check-before-replay.patch new file mode 100644 index 0000000..c224aa2 --- /dev/null +++ b/ldiskfs/kernel_patches/patches/sles12sp2/ext4-dont-check-before-replay.patch @@ -0,0 +1,35 @@ +Index: linux-stage/fs/ext4/super.c +When ldiskfs run in failover mode whith read-only disk. +Part of allocation updates are lost and ldiskfs may fail +while mounting this is due to inconsistent state of +group-descriptor. Group-descriptor check is added after +journal replay. +=================================================================== +--- linux-stage/fs/ext4/super.c 2016-11-06 15:15:30.892386878 +0530 ++++ linux-stage.orig.1/fs/ext4/super.c 2016-11-08 10:56:45.579892189 +0530 +@@ -3980,11 +3980,6 @@ + goto failed_mount2; + } + } +- if (!ext4_check_descriptors(sb, logical_sb_block, &first_not_zeroed)) { +- ext4_msg(sb, KERN_ERR, "group descriptors corrupted!"); +- ret = -EFSCORRUPTED; +- goto failed_mount2; +- } + + sbi->s_gdb_count = db_count; + get_random_bytes(&sbi->s_next_generation, sizeof(u32)); +@@ -4104,6 +4100,13 @@ + sbi->s_journal->j_commit_callback = ext4_journal_commit_callback; + + no_journal: ++ ++ if (!ext4_check_descriptors(sb, logical_sb_block, &first_not_zeroed)) { ++ ext4_msg(sb, KERN_ERR, "group descriptors corrupted!"); ++ ret = -EFSCORRUPTED; ++ goto failed_mount_wq; ++ } ++ + sbi->s_mb_cache = ext4_xattr_create_cache(); + if (!sbi->s_mb_cache) { + ext4_msg(sb, KERN_ERR, "Failed to create an mb_cache"); diff --git a/ldiskfs/kernel_patches/series/ldiskfs-3.0-sles11sp3.series b/ldiskfs/kernel_patches/series/ldiskfs-3.0-sles11sp3.series index 7806d12..be27380 100644 --- a/ldiskfs/kernel_patches/series/ldiskfs-3.0-sles11sp3.series +++ b/ldiskfs/kernel_patches/series/ldiskfs-3.0-sles11sp3.series @@ -42,3 +42,5 @@ sles11sp3/ext4-mmp-brelse.patch sles11sp3/ext4_s_max_ext_tree_depth.patch sles11sp1/ext4-notalloc_under_idatasem.patch rhel6.5/ext4-fix-journal-quota.patch +sles11sp3/ext4-dont-check-before-replay.patch +rhel6.3/ext4-dont-check-in-ro.patch diff --git a/ldiskfs/kernel_patches/series/ldiskfs-4.4-sles12sp2.series b/ldiskfs/kernel_patches/series/ldiskfs-4.4-sles12sp2.series index 3fe547b..546b30d 100644 --- a/ldiskfs/kernel_patches/series/ldiskfs-4.4-sles12sp2.series +++ b/ldiskfs/kernel_patches/series/ldiskfs-4.4-sles12sp2.series @@ -21,3 +21,5 @@ sles12sp2/ext4-give-warning-with-dir-htree-growing.patch sles12sp2/ext4-mmp-brelse.patch rhel7/ext4-jcb-optimization.patch sles12sp2/ext4-attach-jinode-in-writepages.patch +sles12sp2/ext4-dont-check-before-replay.patch +rhel7.2/ext4-dont-check-in-ro.patch -- 1.8.3.1