summaryrefslogtreecommitdiff
path: root/misc/tune2fs.c
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2020-04-01 13:32:36 -0700
committerTheodore Ts'o <tytso@mit.edu>2020-04-10 11:23:12 -0400
commitb88883f78755f8bb4fdd8b060e82a253f21e2dfa (patch)
treeae35010586e3bb2585746d76a67fd619df5e9858 /misc/tune2fs.c
parentaf7293fe8a6d7b9af70f90b1ccdc91a0e2fec7f8 (diff)
downloade2fsprogs-b88883f78755f8bb4fdd8b060e82a253f21e2dfa.tar.gz
tune2fs: prevent changing UUID of fs with stable_inodes feature
The stable_inodes feature is intended to indicate that it's safe to use IV_INO_LBLK_64 encryption policies, where the encryption depends on the inode numbers and thus filesystem shrinking is not allowed. However since inode numbers are not unique across filesystems, the encryption also depends on the filesystem UUID, and I missed that there is a supported way to change the filesystem UUID (tune2fs -U). So, make 'tune2fs -U' report an error if stable_inodes is set. We could add a separate stable_uuid feature flag, but it seems unlikely it would be useful enough on its own to warrant another flag. Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'misc/tune2fs.c')
-rw-r--r--misc/tune2fs.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/misc/tune2fs.c b/misc/tune2fs.c
index 314cc0d0..ca06c98b 100644
--- a/misc/tune2fs.c
+++ b/misc/tune2fs.c
@@ -3236,6 +3236,13 @@ _("Warning: The journal is dirty. You may wish to replay the journal like:\n\n"
char buf[SUPERBLOCK_SIZE] __attribute__ ((aligned(8)));
__u8 old_uuid[UUID_SIZE];
+ if (ext2fs_has_feature_stable_inodes(fs->super)) {
+ fputs(_("Cannot change the UUID of this filesystem "
+ "because it has the stable_inodes feature "
+ "flag.\n"), stderr);
+ exit(1);
+ }
+
if (!ext2fs_has_feature_csum_seed(fs->super) &&
(ext2fs_has_feature_metadata_csum(fs->super) ||
ext2fs_has_feature_ea_inode(fs->super))) {