* [PATCH 1/3] btrfs: define SUPER_FLAG_METADUMP_V2
2018-01-09 1:05 [PATCH 0/3] Add missing flags in the kernel Anand Jain
@ 2018-01-09 1:05 ` Anand Jain
2018-01-09 16:53 ` David Sterba
2018-01-09 1:05 ` [PATCH 2/3] btrfs: add support for SUPER_FLAG_CHANGING_FSID in btrfs.ko Anand Jain
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Anand Jain @ 2018-01-09 1:05 UTC (permalink / raw)
To: linux-btrfs; +Cc: wqu
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 <anand.jain@oracle.com>
---
fs/btrfs/disk-io.c | 3 ++-
include/uapi/linux/btrfs_tree.h | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index a69e5944dc08..7cd4935f690f 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -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);
diff --git a/include/uapi/linux/btrfs_tree.h b/include/uapi/linux/btrfs_tree.h
index 6d6e5da51527..38ab0e06259a 100644
--- a/include/uapi/linux/btrfs_tree.h
+++ b/include/uapi/linux/btrfs_tree.h
@@ -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)
/*
--
2.15.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH 1/3] btrfs: define SUPER_FLAG_METADUMP_V2
2018-01-09 1:05 ` [PATCH 1/3] btrfs: define SUPER_FLAG_METADUMP_V2 Anand Jain
@ 2018-01-09 16:53 ` David Sterba
0 siblings, 0 replies; 8+ messages in thread
From: David Sterba @ 2018-01-09 16:53 UTC (permalink / raw)
To: Anand Jain; +Cc: linux-btrfs, wqu
On Tue, Jan 09, 2018 at 09:05:41AM +0800, Anand Jain wrote:
> 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 <anand.jain@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
> ---
> fs/btrfs/disk-io.c | 3 ++-
> include/uapi/linux/btrfs_tree.h | 1 +
> 2 files changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> index a69e5944dc08..7cd4935f690f 100644
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -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);
> diff --git a/include/uapi/linux/btrfs_tree.h b/include/uapi/linux/btrfs_tree.h
> index 6d6e5da51527..38ab0e06259a 100644
> --- a/include/uapi/linux/btrfs_tree.h
> +++ b/include/uapi/linux/btrfs_tree.h
> @@ -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)
>
>
> /*
> --
> 2.15.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/3] btrfs: add support for SUPER_FLAG_CHANGING_FSID in btrfs.ko
2018-01-09 1:05 [PATCH 0/3] Add missing flags in the kernel Anand Jain
2018-01-09 1:05 ` [PATCH 1/3] btrfs: define SUPER_FLAG_METADUMP_V2 Anand Jain
@ 2018-01-09 1:05 ` Anand Jain
2018-01-09 16:58 ` David Sterba
2018-01-09 1:05 ` [PATCH 3/3] btrfs: fail mount when sb flag is not in BTRFS_SUPER_FLAG_SUPP Anand Jain
2018-01-09 2:32 ` [PATCH V4 0/3] Add missing flags in the kernel Anand Jain
3 siblings, 1 reply; 8+ messages in thread
From: Anand Jain @ 2018-01-09 1:05 UTC (permalink / raw)
To: linux-btrfs; +Cc: wqu
Userland 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.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
cc: wqu@suse.com
Reviewed-by: Qu Wenruo <wqu@suse.com>
---
include/uapi/linux/btrfs_tree.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/uapi/linux/btrfs_tree.h b/include/uapi/linux/btrfs_tree.h
index 38ab0e06259a..aff1356c2bb8 100644
--- a/include/uapi/linux/btrfs_tree.h
+++ b/include/uapi/linux/btrfs_tree.h
@@ -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)
/*
--
2.15.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH 2/3] btrfs: add support for SUPER_FLAG_CHANGING_FSID in btrfs.ko
2018-01-09 1:05 ` [PATCH 2/3] btrfs: add support for SUPER_FLAG_CHANGING_FSID in btrfs.ko Anand Jain
@ 2018-01-09 16:58 ` David Sterba
0 siblings, 0 replies; 8+ messages in thread
From: David Sterba @ 2018-01-09 16:58 UTC (permalink / raw)
To: Anand Jain; +Cc: linux-btrfs, wqu
On Tue, Jan 09, 2018 at 09:05:42AM +0800, Anand Jain wrote:
> Userland 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.
>
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> cc: wqu@suse.com
> Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/3] btrfs: fail mount when sb flag is not in BTRFS_SUPER_FLAG_SUPP
2018-01-09 1:05 [PATCH 0/3] Add missing flags in the kernel Anand Jain
2018-01-09 1:05 ` [PATCH 1/3] btrfs: define SUPER_FLAG_METADUMP_V2 Anand Jain
2018-01-09 1:05 ` [PATCH 2/3] btrfs: add support for SUPER_FLAG_CHANGING_FSID in btrfs.ko Anand Jain
@ 2018-01-09 1:05 ` Anand Jain
2018-01-09 16:57 ` David Sterba
2018-01-09 2:32 ` [PATCH V4 0/3] Add missing flags in the kernel Anand Jain
3 siblings, 1 reply; 8+ messages in thread
From: Anand Jain @ 2018-01-09 1:05 UTC (permalink / raw)
To: linux-btrfs; +Cc: wqu
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]
commit 319e4d0661e5323c9f9945f0f8fb5905e5fe74c3
btrfs: Enhance super validation check
Signed-off-by: Anand Jain <anand.jain@oracle.com>
cc: wqu@suse.com
Reviewed-by: Qu Wenruo <wqu@suse.com>
---
fs/btrfs/disk-io.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 7cd4935f690f..b5fe6eb7b697 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -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);
--
2.15.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH V4 0/3] Add missing flags in the kernel
2018-01-09 1:05 [PATCH 0/3] Add missing flags in the kernel Anand Jain
` (2 preceding siblings ...)
2018-01-09 1:05 ` [PATCH 3/3] btrfs: fail mount when sb flag is not in BTRFS_SUPER_FLAG_SUPP Anand Jain
@ 2018-01-09 2:32 ` Anand Jain
3 siblings, 0 replies; 8+ messages in thread
From: Anand Jain @ 2018-01-09 2:32 UTC (permalink / raw)
To: linux-btrfs; +Cc: wqu
(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(-)
--
2.15.0
^ permalink raw reply [flat|nested] 8+ messages in thread