]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_db: disallow sb UUID write on v5 filesystems
authorEric Sandeen <sandeen@redhat.com>
Sun, 12 Apr 2015 23:33:47 +0000 (09:33 +1000)
committerDave Chinner <david@fromorbit.com>
Sun, 12 Apr 2015 23:33:47 +0000 (09:33 +1000)
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 <fstoyan@swapon.de>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
db/sb.c

diff --git a/db/sb.c b/db/sb.c
index 6cb665d37a518a55fa441035c111b25c1d4c39d5..23ec87cfefad7eef48ed750ff2ace218f5812c4f 100644 (file)
--- 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")) {