Whamcloud - gitweb
LU-8364 ldiskfs: fixes for failover mode. 41/21141/7
authorLokesh Nagappa Jaliminche <lokesh.jaliminche@seagate.com>
Fri, 25 Nov 2016 10:47:09 +0000 (16:17 +0530)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 17 Dec 2016 05:36:10 +0000 (05:36 +0000)
when ldiskfs runs in failover mode with read-only disk,
it may loose part of allocation updates and fail while
mounting fs due to group descriptor checks before journal
replay.
don't produce panic's with on disk checks in read-only mode.

Seagate-bug-id: MRP-797
Change-Id: I54bee3a0aeb9a15f5ee2a79f7a2a2a905f19af1a
Signed-off-by: Alexey Lyashkov <alexey_lyashkov@xyratex.com>
Signed-off-by: Lokesh Nagappa Jaliminche <lokesh.jaliminche@seagate.com>
Reviewed-on: https://morpheus.xyus.xyratex.com:8443/gerrit/239
Reviewed-by: Andrew Perepechko <Andrew_Perepechko@xyratex.com>
Reviewed-by: Alexander Zarochentsev <alexander_zarochentsev@xyratex.com>
Tested-by: Alexander Lezhoev <Alexander_Lezhoev@xyratex.com>
Reviewed-by: Vitaly Fertman <Vitaly_Fertman@xyratex.com>
Reviewed-on: https://review.whamcloud.com/21141
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Yang Sheng <yang.sheng@intel.com>
ldiskfs/kernel_patches/patches/rhel6.3/ext4-dont-check-before-replay.patch [new file with mode: 0644]
ldiskfs/kernel_patches/patches/rhel6.3/ext4-dont-check-in-ro.patch [new file with mode: 0644]
ldiskfs/kernel_patches/patches/rhel7.2/ext4-dont-check-before-replay.patch [new file with mode: 0644]
ldiskfs/kernel_patches/patches/rhel7.2/ext4-dont-check-in-ro.patch [new file with mode: 0644]
ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel6.4.series
ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel6.5.series
ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel6.series
ldiskfs/kernel_patches/series/ldiskfs-3.10-rhel7.2.series

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
new file mode 100644 (file)
index 0000000..e0af295
--- /dev/null
@@ -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_mount2;
++      }
+       if (test_opt(sb, NOBH)) {
+               if (!(test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_WRITEBACK_DATA)) {
+                       ext4_msg(sb, KERN_WARNING, "Ignoring nobh option - "
diff --git a/ldiskfs/kernel_patches/patches/rhel6.3/ext4-dont-check-in-ro.patch b/ldiskfs/kernel_patches/patches/rhel6.3/ext4-dont-check-in-ro.patch
new file mode 100644 (file)
index 0000000..8d77ab2
--- /dev/null
@@ -0,0 +1,28 @@
+--- linux-stage/fs/ext4/mballoc.c      2016-11-25 15:31:40.353249364 +0530
++++ linux-stage.orig/fs/ext4/mballoc.c 2016-11-25 15:35:07.816249363 +0530
+@@ -3369,6 +3369,11 @@
+       unsigned short max = EXT4_BLOCKS_PER_GROUP(sb);
+       unsigned short i, first, free = 0;
++#ifdef HAVE_CLEAR_RDONLY_ON_PUT
++      /* be quiet if readonly device */
++      if (dev_check_rdonly(sb->s_bdev))
++              return 0;
++#endif
+       i = mb_find_next_zero_bit(bitmap, max, 0);
+       while (i < max) {
+@@ -3750,6 +3755,13 @@
+               bit = next + 1;
+       }
++#ifdef HAVE_CLEAR_RDONLY_ON_PUT
++      /* be quiet if readonly device */
++      if (dev_check_rdonly(sb->s_bdev)) {
++              atomic_add(free, &sbi->s_mb_discarded);
++              return err;
++      }
++#endif
+       /* "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)) {
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
new file mode 100644 (file)
index 0000000..9fb9fa1
--- /dev/null
@@ -0,0 +1,33 @@
+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,10 +3980,6 @@
+                       goto failed_mount2;
+               }
+       }
+-      if (!ext4_check_descriptors(sb, &first_not_zeroed)) {
+-              ext4_msg(sb, KERN_ERR, "group descriptors corrupted!");
+-              goto failed_mount2;
+-      }
+
+       sbi->s_gdb_count = db_count;
+       get_random_bytes(&sbi->s_next_generation, sizeof(u32));
+@@ -4104,6 +4100,12 @@
+       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_mount2;
++      }
++
+       /*
+        * Get the # of file system overhead blocks from the
+        * superblock if present.
diff --git a/ldiskfs/kernel_patches/patches/rhel7.2/ext4-dont-check-in-ro.patch b/ldiskfs/kernel_patches/patches/rhel7.2/ext4-dont-check-in-ro.patch
new file mode 100644 (file)
index 0000000..9fa9194
--- /dev/null
@@ -0,0 +1,29 @@
+--- linux-stage/fs/ext4/mballoc.c      2016-11-25 04:15:25.824396109 +0530
++++ linux-stage.orig/fs/ext4/mballoc.c 2016-11-25 02:59:13.505151246 +0530
+@@ -3594,6 +3594,11 @@
+       unsigned short max = EXT4_CLUSTERS_PER_GROUP(sb);
+       unsigned short i, first, free = 0;
++#ifdef HAVE_CLEAR_RDONLY_ON_PUT
++      /* be quiet if readonly device */
++      if (dev_check_rdonly(sb->s_bdev))
++              return 0;
++#endif
+       i = mb_find_next_zero_bit(bitmap, max, 0);
+       while (i < max) {
+@@ -3969,6 +3974,14 @@
+               bit = next + 1;
+       }
++
++#ifdef HAVE_CLEAR_RDONLY_ON_PUT
++      /* be quiet if readonly device */
++      if (dev_check_rdonly(sb->s_bdev)) {
++              atomic_add(free, &sbi->s_mb_discarded);
++              return err;
++      }
++#endif
+       /* "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)) {
index e057b99..1947efd 100644 (file)
@@ -42,3 +42,5 @@ rhel6.3/ext4-journal-path-opt.patch
 rhel6.3/ext4-recalc-percpu-counters-after-journal.patch
 rhel6.3/ext4-drop-inode-from-orphan-list-if-ext4_delete_inode-fails.patch
 rhel6.3/ext4-notalloc_under_idatasem.patch
+rhel6.3/ext4-dont-check-in-ro.patch
+rhel6.3/ext4-dont-check-before-replay.patch
index 42434ef..43d8ff4 100644 (file)
@@ -45,3 +45,5 @@ rhel6.3/ext4-drop-inode-from-orphan-list-if-ext4_delete_inode-fails.patch
 rhel6.3/ext4-notalloc_under_idatasem.patch
 rhel6.5/ext4-give-warning-with-dir-htree-growing.patch
 rhel6.5/ext4-fix-journal-quota.patch
+rhel6.3/ext4-dont-check-in-ro.patch
+rhel6.3/ext4-dont-check-before-replay.patch
index fa841e6..178e310 100644 (file)
@@ -41,3 +41,5 @@ rhel6.3/ext4-not-discard-preallocation-umount.patch
 rhel6.3/ext4-journal-path-opt.patch
 rhel6.3/ext4-recalc-percpu-counters-after-journal.patch
 rhel6.3/ext4-notalloc_under_idatasem.patch
+rhel6.3/ext4-dont-check-in-ro.patch
+rhel6.3/ext4-dont-check-before-replay.patch
index a3a895c..0f90ca0 100644 (file)
@@ -22,3 +22,5 @@ rhel7/ext4-mmp-brelse.patch
 rhel7/ext4-jcb-optimization.patch
 rhel7/ext4_s_max_ext_tree_depth.patch
 rhel7.2/ext4-release-bh-in-makeinxdir.patch
+rhel7.2/ext4-dont-check-in-ro.patch
+rhel7.2/ext4-dont-check-before-replay.patch