Add missing flags in the kernel.
cover Add missing flags in the kernel.
v3->v4:
Patch reordered.
Add BTRFS_SUPER_FLAG_METADUMP_V2 to BTRFS_SUPER_FLAG_SUPP
v2->v3:
Modify BTRFS_SUPER_FLAG_SUPP so that it would fail instead of warn.
v1->v2:
Fail to mount if BTRFS_SUPER_FLAG_CHANGING_FSID is set.
Following bits are already used in user land, so bring it to the kernel as well.
#define BTRFS_SUPER_FLAG_METADUMP_V2 (1ULL << 34)
#define BTRFS_SUPER_FLAG_CHANGING_FSID (1ULL << 35)
Anand Jain (3):
btrfs: define SUPER_FLAG_METADUMP_V2
btrfs: add support for SUPER_FLAG_CHANGING_FSID in btrfs.ko
btrfs: fail mount when sb flag is not in BTRFS_SUPER_FLAG_SUPP
fs/btrfs/disk-io.c | 9 ++++++--- include/uapi/linux/btrfs_tree.h | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-)
Signature · 1 line
2.15.0
PATCH 1/3 btrfs: define SUPER_FLAG_METADUMP_V2
btrfs-progs uses super flag bit BTRFS_SUPER_FLAG_METADUMP_V2 (1ULL << 34). So just define that in kernel so that we know its been used.
--- fs/btrfs/disk-io.c | 3 ++- include/uapi/linux/btrfs_tree.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
fs/btrfs/disk-io.c +2 -1
@@ -61,7 +61,8 @@ BTRFS_HEADER_FLAG_RELOC |\ BTRFS_SUPER_FLAG_ERROR |\ BTRFS_SUPER_FLAG_SEEDING |\ - BTRFS_SUPER_FLAG_METADUMP) + BTRFS_SUPER_FLAG_METADUMP |\ + BTRFS_SUPER_FLAG_METADUMP_V2)static const struct extent_io_ops btree_extent_io_ops;static void end_workqueue_fn (struct btrfs_work *work);
include/uapi/linux/btrfs_tree.h +1 -0
@@ -456,6 +456,7 @@ struct btrfs_free_space_header {#define BTRFS_SUPER_FLAG_SEEDING (1ULL << 32)#define BTRFS_SUPER_FLAG_METADUMP (1ULL << 33) +#define BTRFS_SUPER_FLAG_METADUMP_V2 (1ULL << 34)/*
Signature · 1 line
2.15.0
Re: [PATCH 1/3] btrfs: define SUPER_FLAG_METADUMP_V2
Quoted 4 lines · Anand Jain
btrfs-progs uses super flag bit
BTRFS_SUPER_FLAG_METADUMP_V2(1ULL << 34). So just define that in kernel so that we know its been used.Signed-off-by Anand Jain <[email protected]>
Quoted 38 lines
--- fs/btrfs/disk-io.c | 3 ++- include/uapi/linux/btrfs_tree.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)fs/btrfs/disk-io.c +2
-1@@ -61,7 +61,8 @@ BTRFS_HEADER_FLAG_RELOC |\ BTRFS_SUPER_FLAG_ERROR |\ BTRFS_SUPER_FLAG_SEEDING |\ - BTRFS_SUPER_FLAG_METADUMP) + BTRFS_SUPER_FLAG_METADUMP |\ + BTRFS_SUPER_FLAG_METADUMP_V2)static const struct extent_io_ops btree_extent_io_ops;static void end_workqueue_fn (struct btrfs_work *work);include/uapi/linux/btrfs_tree.h +1
-0@@ -456,6 +456,7 @@ struct btrfs_free_space_header {#define BTRFS_SUPER_FLAG_SEEDING (1ULL << 32)#define BTRFS_SUPER_FLAG_METADUMP (1ULL << 33) +#define BTRFS_SUPER_FLAG_METADUMP_V2 (1ULL << 34)/* Signature · 6 lines
2.15.0 -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 2/3 btrfs: add support for SUPER_FLAG_CHANGING_FSID in btrfs.ko
In reply to Anand JainUserland sets SUPER_FLAG_CHANGING_FSID and resets it only when changing fsid is complete. Its not a good idea to mount the device anything in between.
This patch doesn't add SUPER_FLAG_CHANGING_FSID into BTRFS_SUPER_FLAG_SUPP list, so mount would fail (along with the fix in the next patch) when SUPER_FLAG_CHANGING_FSID is set.
--- include/uapi/linux/btrfs_tree.h | 1 + 1 file changed, 1 insertion(+)
include/uapi/linux/btrfs_tree.h +1 -0
@@ -457,6 +457,7 @@ struct btrfs_free_space_header {#define BTRFS_SUPER_FLAG_SEEDING (1ULL << 32)#define BTRFS_SUPER_FLAG_METADUMP (1ULL << 33)#define BTRFS_SUPER_FLAG_METADUMP_V2 (1ULL << 34) +#define BTRFS_SUPER_FLAG_CHANGING_FSID (1ULL << 35)/*
Signature · 1 line
2.15.0
Re: [PATCH 2/3] btrfs: add support for SUPER_FLAG_CHANGING_FSID in btrfs.ko
Quoted 10 lines · Anand Jain
Userland sets
SUPER_FLAG_CHANGING_FSIDand resets it only when changing fsid is complete. Its not a good idea to mount the device anything in between.
This patch doesn't addSUPER_FLAG_CHANGING_FSIDintoBTRFS_SUPER_FLAG_SUPPlist, so mount would fail (along with the fix in the next patch) whenSUPER_FLAG_CHANGING_FSIDis set.Signed-off-by Anand Jain <[email protected]>Reviewed-by Qu Wenruo <[email protected]>
PATCH 3/3 btrfs: fail mount when sb flag is not in BTRFS_SUPER_FLAG_SUPP
In reply to Anand JainIt appear from the original commit [1] that there isn't any design specific reason not to fail the mount instead of just warning. This patch will change it to fail.
[1]
commit 319e4d0661e5323c9f9945f0f8fb5905e5fe74c3
btrfs: Enhance super validation check
--- fs/btrfs/disk-io.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/btrfs/disk-io.c +4 -2
@@ -3907,9 +3907,11 @@ static int btrfs_check_super_valid(struct btrfs_fs_info *fs_info)btrfs_err (fs_info,"no valid FS found" ); ret = -EINVAL ; } -if (btrfs_super_flags (sb) & ~BTRFS_SUPER_FLAG_SUPP ) -btrfs_warn (fs_info,"unrecognized super flag: %llu" , +if (btrfs_super_flags (sb) & ~BTRFS_SUPER_FLAG_SUPP ) { +btrfs_err (fs_info,"unrecognized or unsupported super flag: %llu" ,btrfs_super_flags (sb) & ~BTRFS_SUPER_FLAG_SUPP ); + ret = -EINVAL ; + }if (btrfs_super_root_level (sb) >=BTRFS_MAX_LEVEL ) {btrfs_err (fs_info,"tree_root level too big: %d >= %d" ,btrfs_super_root_level (sb),BTRFS_MAX_LEVEL );
Signature · 1 line
2.15.0
Re: [PATCH 3/3] btrfs: fail mount when sb flag is not in BTRFS_SUPER_FLAG_SUPP
Quoted 11 lines · Anand Jain
It appear from the original commit [1] that there isn't any design specific reason not to fail the mount instead of just warning. This patch will change it to fail.
[1]
commit319e4d0661e5323c9f9945f0f8fb5905e5fe74c3
btrfs: Enhance super validation checkSigned-off-by Anand Jain <[email protected]>Reviewed-by Qu Wenruo <[email protected]>
v4 cover Add missing flags in the kernel
In reply to Anand Jain(added reroll count in the $subject)
v3->v4:
Patch reordered.
Add BTRFS_SUPER_FLAG_METADUMP_V2 to BTRFS_SUPER_FLAG_SUPP
v2->v3:
Modify BTRFS_SUPER_FLAG_SUPP so that it would fail instead of warn.
v1->v2:
Fail to mount if BTRFS_SUPER_FLAG_CHANGING_FSID is set.
Following bits are already used in user land, so bring it to the kernel as well.
#define BTRFS_SUPER_FLAG_METADUMP_V2 (1ULL << 34)
#define BTRFS_SUPER_FLAG_CHANGING_FSID (1ULL << 35)
Anand Jain (3):
btrfs: define SUPER_FLAG_METADUMP_V2
btrfs: add support for SUPER_FLAG_CHANGING_FSID in btrfs.ko
btrfs: fail mount when sb flag is not in BTRFS_SUPER_FLAG_SUPP
fs/btrfs/disk-io.c | 9 ++++++--- include/uapi/linux/btrfs_tree.h | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-)
Signature · 1 line
2.15.0