]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_db: modify bad_features2 when modifying features2
authorEric Sandeen <sandeen@sandeen.net>
Wed, 2 Dec 2009 17:19:48 +0000 (11:19 -0600)
committerEric Sandeen <sandeen@sandeen.net>
Wed, 2 Dec 2009 17:19:48 +0000 (11:19 -0600)
The "attr1" command in xfs_db, for example, only modifies the features2
field; when mounted, the kernel will find a mismatch between features2
and bad_features2, and attr2 gets turned back on.

I think the simplest fix is to modify do_version to modify both fields,
but not if there is an existing mismatch that should be investigated
first.

Any mismatch can be fixed up by writing directly to the superblock
fields.

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Reviewed-by: Christoph Hellwig <hch@lst.de>
db/sb.c

diff --git a/db/sb.c b/db/sb.c
index 7c61b15a4c325db2490e8ffc59cf7a1c90c1fa54..961a939efce0cdf8c8bd4ec52005dec23786e5b4 100644 (file)
--- a/db/sb.c
+++ b/db/sb.c
@@ -556,6 +556,12 @@ do_version(xfs_agnumber_t agno, __uint16_t version, __uint32_t features)
        if (!get_sb(agno, &tsb))
                return 0;
 
+       if (xfs_sb_has_mismatched_features2(&tsb)) {
+               dbprintf(_("Superblock has mismatched features2 fields, "
+                          "skipping modification\n"));
+               return 0;
+       }
+
        if ((version & XFS_SB_VERSION_LOGV2BIT) &&
                                        !xfs_sb_version_haslogv2(&tsb)) {
                tsb.sb_logsunit = 1;
@@ -564,7 +570,8 @@ do_version(xfs_agnumber_t agno, __uint16_t version, __uint32_t features)
 
        tsb.sb_versionnum = version;
        tsb.sb_features2 = features;
-       fields |= XFS_SB_VERSIONNUM | XFS_SB_FEATURES2;
+       tsb.sb_bad_features2 = features;
+       fields |= XFS_SB_VERSIONNUM | XFS_SB_FEATURES2 | XFS_SB_BAD_FEATURES2;
        libxfs_sb_to_disk(iocur_top->data, &tsb, fields);
        write_cur();
        return 1;