Skip to contentSkip to conversation

xfs_db: disallow sb UUID write on v5 filesystems

PATCH In review Eric Sandeen 3 participants 3 messages Apr 6, 2015 – Apr 7, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs_db: disallow sb UUID write on v5 filesystems

Do not allow xfs_db (or the xfs_admin frontend) to change the UUID of a V5 filesystem; this will cause UUID mismatches across the filesystem, and we currently have no mechanism to update them all. Changing only the superblock UUID makes all other metadata look invalid, and xfs_repair reacts by junking everything.

Addresses-Debian-Bug: 782012

---

db/sb.c +12 -0
index 6cb665d..f31f4a2 100644
@@ -363,6 +363,18 @@ uuid_f(
 			return 0;
 		}
 
+		/*
+		* For now, changing the UUID of V5 superblock filesystems is
+		* not supported; we do not have the infrastructure to fix all
+		* other metadata when a new superblock UUID is generated.
+		*/
+		if (xfs_sb_version_hascrc(&mp->m_sb) &&
+		    strcasecmp(argv[1], "rewrite")) {
+			dbprintf(_("%s: only 'rewrite' supported on V5 fs\n"),
+				progname);
+			return 0;
+		}
+
 		if (!strcasecmp(argv[1], "generate")) {
 			platform_uuid_generate(&uu);
 		} else if (!strcasecmp(argv[1], "nil")) {

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines · Eric Sandeen

Do not allow xfs_db (or the xfs_admin frontend) to change the UUID of a V5 filesystem; this will cause UUID mismatches across the filesystem, and we currently have no mechanism to update them all. Changing only the superblock UUID makes all other metadata look invalid, and xfs_repair reacts by junking everything.

Addresses-Debian-Bug: 782012

---

db/sb.c +0 -0
index 6cb665d..f31f4a2 100644

db/sb.c uuid_f( · line 370

Quoted 8 lines
db/sb.c +5 -0
@@ -363,6 +363,18 @@ uuid_f(
 			return 0;
 		}
 
+		/*
+		* For now, changing the UUID of V5 superblock filesystems is
+		* not supported; we do not have the infrastructure to fix all
+		* other metadata when a new superblock UUID is generated.
+		*/

Unaligned start of comment above. :) Otherwise looks fine to me:

Quoted 11 lines
db/sb.c +7 -0
+		if (xfs_sb_version_hascrc(&mp->m_sb) &&
+		    strcasecmp(argv[1], "rewrite")) {
+			dbprintf(_("%s: only 'rewrite' supported on V5 fs\n"),
+				progname);
+			return 0;
+		}
+
 		if (!strcasecmp(argv[1], "generate")) {
 			platform_uuid_generate(&uu);
 		} else if (!strcasecmp(argv[1], "nil")) {
Quoted 4 lines

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#2 lore raw

PATCH v2 1/1 xfs_db: disallow sb UUID write on v5 filesystems

In reply to Eric Sandeen

Do not allow xfs_db (or the xfs_admin frontend) to change the UUID of a V5 filesystem; this will cause UUID mismatches across the filesystem, and we currently have no mechanism to update them all. Changing only the superblock UUID makes all other metadata look invalid, and xfs_repair reacts by junking everything.

Addresses-Debian-Bug: 782012

---

V2, fix up comment whitespace :/
(and add brian's review for dave's convenience)

db/sb.c +12 -0
index 6cb665d..f31f4a2 100644
@@ -363,6 +363,18 @@ uuid_f(
 			return 0;
 		}
 
+		/*
+		 * For now, changing the UUID of V5 superblock filesystems is
+		 * not supported; we do not have the infrastructure to fix all
+		 * other metadata when a new superblock UUID is generated.
+		 */
+		if (xfs_sb_version_hascrc(&mp->m_sb) &&
+		    strcasecmp(argv[1], "rewrite")) {
+			dbprintf(_("%s: only 'rewrite' supported on V5 fs\n"),
+				progname);
+			return 0;
+		}
+
 		if (!strcasecmp(argv[1], "generate")) {
 			platform_uuid_generate(&uu);
 		} else if (!strcasecmp(argv[1], "nil")) {

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs