mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git
synced 2024-12-04 01:24:20 +08:00
btrfs-progs: convert: refuse to convert filesystem with 'needs_recovery' set
As Chris reports: This ext4 file system has 'needs_recovery' feature set, and if mounted rw, log replay happens. But btrfs-convert doesn't check for it and converts anyway. It probably shouldn't. # debugfs -R stats /dev/loop0 debugfs 1.45.6 (20-Mar-2020) Filesystem volume name: <none> Last mounted on: /mnt/0 Filesystem UUID: d3e3862e-f892-4ab7-ae91-84eb4be4a3ef Filesystem magic number: 0xEF53 Filesystem revision #: 1 (dynamic) Filesystem features: has_journal ext_attr resize_inode dir_index filetype needs_recovery extent 64bit flex_bg sparse_super large_file huge_file dir_nlink extra_isize metadata_csum Filesystem flags: signed_directory_hash Default mount options: user_xattr acl Filesystem state: clean Errors behavior: Continue ... Then 'btrfs-convert' proceeds, while 'e2fsck -fvn /dev/loop1' finds some problems and wants to fix them. Add a check for the 'needs_recovery' incompat bit set and don't convert the filesystem. Issue: #348 Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
098e08b269
commit
2c53231af9
@ -43,6 +43,12 @@ static int ext2_open_fs(struct btrfs_convert_context *cctx, const char *name)
|
|||||||
fprintf(stderr, "ext2fs_open: %s\n", error_message(ret));
|
fprintf(stderr, "ext2fs_open: %s\n", error_message(ret));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ext2_fs->super->s_feature_incompat & EXT3_FEATURE_INCOMPAT_RECOVER) {
|
||||||
|
error("source filesystem requires recovery, run e2fsck first");
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We need to know exactly the used space, some RO compat flags like
|
* We need to know exactly the used space, some RO compat flags like
|
||||||
* BIGALLOC will affect how used space is present.
|
* BIGALLOC will affect how used space is present.
|
||||||
|
Loading…
Reference in New Issue
Block a user