From 609f6bb20b7972c1a68370faea1dcbcf39912e07 Mon Sep 17 00:00:00 2001 From: Eric Sandeen Date: Mon, 13 Apr 2015 09:33:47 +1000 Subject: [PATCH] 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 Reported-by: F. Stoyan Signed-off-by: Eric Sandeen Reviewed-by: Dave Chinner Signed-off-by: Dave Chinner --- db/sb.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/db/sb.c b/db/sb.c index 6cb665d37..23ec87cfe 100644 --- a/db/sb.c +++ b/db/sb.c @@ -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")) { -- 2.50.1