mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git
synced 2024-11-28 06:34:17 +08:00
btrfs-progs: subvol show: print a warning with rw and receive_uuid
Add a slightly more convenient way to identify the subvolumes with bad combination of flags and received uuid. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
0a4f9b93ab
commit
cb9bd8e326
@ -1165,6 +1165,14 @@ static int cmd_subvol_show(const struct cmd_struct *cmd, int argc, char **argv)
|
||||
|
||||
}
|
||||
|
||||
/* Warn if it's a read-write subvolume with received_uuid */
|
||||
if (!uuid_is_null(subvol.received_uuid) &&
|
||||
!(subvol.flags & BTRFS_SUBVOL_RDONLY)) {
|
||||
warning("the subvolume is read-write and has received_uuid set,\n"
|
||||
"\t don't use it for incremental send. Please see section\n"
|
||||
"\t 'SUBVOLUME FLAGS' in manual page btrfs-subvolume for\n"
|
||||
"\t further information.");
|
||||
}
|
||||
/* print the info */
|
||||
printf("%s\n", subvol.id == BTRFS_FS_TREE_OBJECTID ? "/" : subvol_path);
|
||||
printf("\tName: \t\t\t%s\n",
|
||||
|
Binary file not shown.
22
tests/misc-tests/051-warning-rw-subvol-received-uuid/test.sh
Executable file
22
tests/misc-tests/051-warning-rw-subvol-received-uuid/test.sh
Executable file
@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
# Look for warning about read-write subvolume with received_uuid set, on a crafted
|
||||
# image
|
||||
|
||||
source "$TEST_TOP/common"
|
||||
|
||||
setup_root_helper
|
||||
prepare_test_dev
|
||||
|
||||
TEST_DEV=$(extract_image "subvol-rw-recv.img")
|
||||
run_check_mount_test_dev
|
||||
if ! run_check_stdout $SUDO_HELPER "$TOP/btrfs" subvolume show "$TEST_MNT/subvol1" |
|
||||
grep -q "WARNING.*received_uuid"; then
|
||||
_fail "no warning found"
|
||||
fi
|
||||
if run_check_stdout $SUDO_HELPER "$TOP/btrfs" subvolume show "$TEST_MNT/snap1" |
|
||||
grep -q "WARNING.*received_uuid"; then
|
||||
_fail "unexpected warning"
|
||||
fi
|
||||
run_check_umount_test_dev
|
||||
|
||||
rm -- "$TEST_DEV"
|
Loading…
Reference in New Issue
Block a user