Blame SOURCES/xfsprogs-3.2.1-copy-stripe-geometry.patch

502773
From: Eric Sandeen <sandeen@redhat.com>
502773
Date: Wed, 16 Jul 2014 03:52:47 +0000 (+1000)
502773
Subject: repair: copy, don't clear, stripe geometry in backup SB
502773
X-Git-Url: http://oss.sgi.com/cgi-bin/gitweb.cgi?p=xfs%2Fcmds%2Fxfsprogs.git;a=commitdiff_plain;h=6bf4721d47d9755029a7ec944af2832bd115a851
502773
502773
repair: copy, don't clear, stripe geometry in backup SB
502773
502773
Today, if we have a filesystem with stripe geometry and
502773
a damaged primary superblock, we will zero out stripe geometry
502773
if we have copied the backup.
502773
502773
I'm guessing this might be because changing geometry with mount
502773
options only updates the primary, so backups aren't guaranteed
502773
to be current or correct.
502773
502773
Unfortunately, that leaves us with sb 0 w/ no geom, and backups
502773
*with* geom, so the next repair finds the mismatch, and complains.
502773
(In other words, the 2nd repair does not come up clean.)_
502773
And ... the second repair copies the backup stripe geometry back
502773
into the primary!
502773
502773
Rather than clearing stripe geometry in this case, just leave it
502773
at what was found in the backup super, and inform the user that this
502773
was done.  This leaves a consistent filesystem, and gives the user
502773
a heads-up to double-check the result.
502773
502773
This can all be demonstrated and tested by running xfs/030 with
502773
geometry set in MKFS_OPTIONS.  (To really make the test pass,
502773
we need to filter the warning out of repair output.)
502773
502773
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
502773
Reviewed-by: Brian Foster <bfoster@redhat.com>
502773
Signed-off-by: Dave Chinner <david@fromorbit.com>
502773
---
502773
502773
diff --git a/repair/globals.h b/repair/globals.h
502773
index f6e0a22..6207ca1 100644
502773
--- a/repair/globals.h
502773
+++ b/repair/globals.h
502773
@@ -124,7 +124,7 @@ EXTERN int	lazy_count;		/* What to set if to if converting */
502773
 
502773
 EXTERN int		primary_sb_modified;
502773
 EXTERN int		bad_ino_btree;
502773
-EXTERN int		clear_sunit;
502773
+EXTERN int		copied_sunit;
502773
 EXTERN int		fs_is_dirty;
502773
 
502773
 /* for hunting down the root inode */
502773
diff --git a/repair/sb.c b/repair/sb.c
502773
index bc421cc..ad27756 100644
502773
--- a/repair/sb.c
502773
+++ b/repair/sb.c
502773
@@ -151,7 +151,7 @@ find_secondary_sb(xfs_sb_t *rsb)
502773
 			 */
502773
 			memmove(rsb, &bufsb, sizeof(xfs_sb_t));
502773
 			rsb->sb_inprogress = 0;
502773
-			clear_sunit = 1;
502773
+			copied_sunit = 1;
502773
 
502773
 			if (verify_set_primary_sb(rsb, 0, &dirty) == XR_OK)  {
502773
 				do_warn(
502773
diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c
502773
index 9eb2fa4..834697a 100644
502773
--- a/repair/xfs_repair.c
502773
+++ b/repair/xfs_repair.c
502773
@@ -193,7 +193,7 @@ process_args(int argc, char **argv)
502773
 	delete_attr_ok = 1;
502773
 	force_geo = 0;
502773
 	assume_xfs = 0;
502773
-	clear_sunit = 0;
502773
+	copied_sunit = 0;
502773
 	sb_inoalignmt = 0;
502773
 	sb_unit = 0;
502773
 	sb_width = 0;
502773
@@ -898,13 +898,11 @@ _("Warning:  project quota information would be cleared.\n"
502773
 		dsb->sb_qflags &= cpu_to_be16(~XFS_ALL_QUOTA_CHKD);
502773
 	}
502773
 
502773
-	if (clear_sunit) {
502773
+	if (copied_sunit) {
502773
 		do_warn(
502773
-_("Note - stripe unit (%d) and width (%d) fields have been reset.\n"
502773
-  "Please set with mount -o sunit=<value>,swidth=<value>\n"),
502773
+_("Note - stripe unit (%d) and width (%d) were copied from a backup superblock.\n"
502773
+  "Please reset with mount -o sunit=<value>,swidth=<value> if necessary\n"),
502773
 			be32_to_cpu(dsb->sb_unit), be32_to_cpu(dsb->sb_width));
502773
-		dsb->sb_unit = 0;
502773
-		dsb->sb_width = 0;
502773
 	}
502773
 
502773
 	libxfs_writebuf(sbp, 0);
502773