FAILED: patch "[PATCH] btrfs: enhance unsupported compat RO flags handling" failed to apply to 4.9-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 4.9-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
Possible dependencies:
81d5d61454c3 ("btrfs: enhance unsupported compat RO flags handling") dfe8aec4520b ("btrfs: add a btrfs_block_group_root() helper") b6e9f16c5fda ("btrfs: replace open coded while loop with proper construct") 42437a6386ff ("btrfs: introduce mount option rescue=ignorebadroots") 68319c18cb21 ("btrfs: show rescue=usebackuproot in /proc/mounts") ab0b4a3ebf14 ("btrfs: add a helper to print out rescue= options") ceafe3cc3992 ("btrfs: sysfs: export supported rescue= mount options") 334c16d82cfe ("btrfs: push the NODATASUM check into btrfs_lookup_bio_sums") d70bf7484f72 ("btrfs: unify the ro checking for mount options") 7573df5547c0 ("btrfs: sysfs: export supported send stream version") 3ef3959b29c4 ("btrfs: don't show full path of bind mounts in subvol=") 74ef00185eb8 ("btrfs: introduce "rescue=" mount option")e3ba67a108ff ("btrfs: factor out reading of bg from find_frist_block_group") 89d7da9bc592 ("btrfs: get mapping tree directly from fsinfo in find_first_block_group") c730ae0c6bb3 ("btrfs: convert comments to fallthrough annotations") aeb935a45581 ("btrfs: don't set SHAREABLE flag for data reloc tree") 92a7cc425223 ("btrfs: rename BTRFS_ROOT_REF_COWS to BTRFS_ROOT_SHAREABLE") 3be4d8efe3cf ("btrfs: block-group: rename write_one_cache_group()") 97f4728af888 ("btrfs: block-group: refactor how we insert a block group item") 7357623a7f4b ("btrfs: block-group: refactor how we delete one block group item")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 81d5d61454c365718655cfc87d8200c84e25d596 Mon Sep 17 00:00:00 2001
From: Qu Wenruo <[email protected]>
Date: Tue, 9 Aug 2022 13:02:16 +0800
Subject: [PATCH] btrfs: enhance unsupported compat RO flags handling
Currently there are two corner cases not handling compat RO flags correctly:
- Remount
We can still mount the fs RO with compat RO flags, then remount it RW. We should not allow any write into a fs with unsupported RO flags.
- Still try to search block group items
In fact, behavior/on-disk format change to extent tree should not need a full incompat flag.
And since we can ensure fs with unsupported RO flags never got any writes (with above case fixed), then we can even skip block group items search at mount time.
This patch will enhance the unsupported RO compat flags by:
- Reject read-write remount if there are unsupported RO compat flags
- Go dummy block group items directly for unsupported RO compat flags In fact, only changes to chunk/subvolume/root/csum trees should go incompat flags.
The latter part should allow future change to extent tree to be compat RO flags.
Thus this patch also needs to be backported to all stable trees.
fs/btrfs/block-group.c +10 -1
@@ -2164,7 +2164,16 @@ int btrfs_read_block_groups(struct btrfs_fs_info *info)int need_clear =0 ;u64 cache_gen; -if (!root) +/* +* Either no extent root (with ibadroots rescue option) or we have +* unsupported RO options. The fs can never be mounted read-write, so no +* need to waste time searching block group items. +* +* This also allows new extent tree related changes to be RO compat, +* no need for a full incompat flag. +*/ +if (!root || (btrfs_super_compat_ro_flags (info->super_copy) & + ~BTRFS_FEATURE_COMPAT_RO_SUPP ))return fill_dummy_bgs (info); key.objectid =0 ;
fs/btrfs/super.c +9 -0
@@ -2117,6 +2117,15 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data) ret = -EINVAL ; goto restore; } +if (btrfs_super_compat_ro_flags (fs_info->super_copy) & + ~BTRFS_FEATURE_COMPAT_RO_SUPP ) { +btrfs_err (fs_info, +"can not remount read-write due to unsupported optional flags 0x%llx" , +btrfs_super_compat_ro_flags (fs_info->super_copy) & + ~BTRFS_FEATURE_COMPAT_RO_SUPP ); + ret = -EINVAL ; + goto restore; + }if (fs_info->fs_devices->rw_devices ==0 ) { ret = -EACCES ; goto restore;
Quoted 5 lines · On 2022/10/16 20:25, [email protected] wrote:
The patch below does not apply to the 4.9-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
Thanks for the mail, I'll backport the patch manually.
Just want to praise the new dependency hints.
Quoted 15 lines
Possible dependencies:
81d5d61454c3("btrfs: enhance unsupported compat RO flags handling")dfe8aec4520b("btrfs: add abtrfs_block_group_root()helper")b6e9f16c5fda("btrfs: replace open coded while loop with proper construct")42437a6386ff("btrfs: introduce mount option rescue=ignorebadroots")68319c18cb21("btrfs: show rescue=usebackuproot in/proc/mounts")ab0b4a3ebf14("btrfs: add a helper to print out rescue= options")ceafe3cc3992("btrfs: sysfs: export supported rescue= mount options")334c16d82cfe("btrfs: push the NODATASUM check intobtrfs_lookup_bio_sums")d70bf7484f72("btrfs: unify the ro checking for mount options")7573df5547c0("btrfs: sysfs: export supported send stream version")3ef3959b29c4("btrfs: don't show full path of bind mounts in subvol=")74ef00185eb8("btrfs: introduce "rescue=" mount option")
Quoted 8 lines
e3ba67a108ff("btrfs: factor out reading of bg fromfind_frist_block_group")89d7da9bc592("btrfs: get mapping tree directly from fsinfo infind_first_block_group")c730ae0c6bb3("btrfs: convert comments to fallthrough annotations")aeb935a45581("btrfs: don't set SHAREABLE flag for data reloc tree")92a7cc425223("btrfs: renameBTRFS_ROOT_REF_COWStoBTRFS_ROOT_SHAREABLE")3be4d8efe3cf("btrfs: block-group: renamewrite_one_cache_group()")97f4728af888("btrfs: block-group: refactor how we insert a block group item")7357623a7f4b("btrfs: block-group: refactor how we delete one block group item")
It looks so awesome!!
I'm wondering how this is implemented? It would definitely help backporting not only to stable, but also some vendor backports branches.
Thanks,
Qu
Quoted 89 lines
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From
81d5d61454c365718655cfc87d8200c84e25d596Mon Sep 17 00:00:00 2001
From: Qu Wenruo <[email protected]>
Date: Tue, 9 Aug 2022 13:02:16 +0800
Subject: [PATCH] btrfs: enhance unsupported compat RO flags handlingCurrently there are two corner cases not handling compat RO flags correctly:
- Remount
We can still mount the fs RO with compat RO flags, then remount it RW. We should not allow any write into a fs with unsupported RO flags.- Still try to search block group items
In fact, behavior/on-disk format change to extent tree should not need a full incompat flag.And since we can ensure fs with unsupported RO flags never got any writes (with above case fixed), then we can even skip block group items search at mount time.
This patch will enhance the unsupported RO compat flags by:
- Reject read-write remount if there are unsupported RO compat flags
- Go dummy block group items directly for unsupported RO compat flags In fact, only changes to chunk/subvolume/root/csum trees should go incompat flags.
The latter part should allow future change to extent tree to be compat RO flags.
Thus this patch also needs to be backported to all stable trees.
CC [email protected] # 4.9+Reviewed-by Nikolay Borisov <[email protected]>Signed-off-by Qu Wenruo <[email protected]>Reviewed-by David Sterba <[email protected]>Signed-off-by David Sterba <[email protected]>fs/btrfs/block-group.c +10
-1@@ -2164,7 +2164,16 @@ int btrfs_read_block_groups(struct btrfs_fs_info *info)int need_clear =0 ;u64 cache_gen; -if (!root) +/* +* Either no extent root (with ibadroots rescue option) or we have +* unsupported RO options. The fs can never be mounted read-write, so no +* need to waste time searching block group items. +* +* This also allows new extent tree related changes to be RO compat, +* no need for a full incompat flag. +*/ +if (!root || (btrfs_super_compat_ro_flags (info->super_copy) & + ~BTRFS_FEATURE_COMPAT_RO_SUPP ))return fill_dummy_bgs (info); key.objectid =0 ;fs/btrfs/super.c +9
-0@@ -2117,6 +2117,15 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data) ret = -EINVAL ; goto restore; } +if (btrfs_super_compat_ro_flags (fs_info->super_copy) & + ~BTRFS_FEATURE_COMPAT_RO_SUPP ) { +btrfs_err (fs_info, +"can not remount read-write due to unsupported optional flags 0x%llx" , +btrfs_super_compat_ro_flags (fs_info->super_copy) & + ~BTRFS_FEATURE_COMPAT_RO_SUPP ); + ret = -EINVAL ; + goto restore; + }if (fs_info->fs_devices->rw_devices ==0 ) { ret = -EACCES ; goto restore;
Greg KH
maintainerQuoted 37 lines · Qu Wenruo
Quoted 5 lines · On 2022/10/16 20:25, [email protected] wrote:
The patch below does not apply to the 4.9-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.Thanks for the mail, I'll backport the patch manually.
Just want to praise the new dependency hints.
Quoted 15 lines
Possible dependencies:
81d5d61454c3("btrfs: enhance unsupported compat RO flags handling")dfe8aec4520b("btrfs: add abtrfs_block_group_root()helper")b6e9f16c5fda("btrfs: replace open coded while loop with proper construct")42437a6386ff("btrfs: introduce mount option rescue=ignorebadroots")68319c18cb21("btrfs: show rescue=usebackuproot in/proc/mounts")ab0b4a3ebf14("btrfs: add a helper to print out rescue= options")ceafe3cc3992("btrfs: sysfs: export supported rescue= mount options")334c16d82cfe("btrfs: push the NODATASUM check intobtrfs_lookup_bio_sums")d70bf7484f72("btrfs: unify the ro checking for mount options")7573df5547c0("btrfs: sysfs: export supported send stream version")3ef3959b29c4("btrfs: don't show full path of bind mounts in subvol=")74ef00185eb8("btrfs: introduce "rescue=" mount option")Quoted 8 lines
e3ba67a108ff("btrfs: factor out reading of bg fromfind_frist_block_group")89d7da9bc592("btrfs: get mapping tree directly from fsinfo infind_first_block_group")c730ae0c6bb3("btrfs: convert comments to fallthrough annotations")aeb935a45581("btrfs: don't set SHAREABLE flag for data reloc tree")92a7cc425223("btrfs: renameBTRFS_ROOT_REF_COWStoBTRFS_ROOT_SHAREABLE")3be4d8efe3cf("btrfs: block-group: renamewrite_one_cache_group()")97f4728af888("btrfs: block-group: refactor how we insert a block group item")7357623a7f4b("btrfs: block-group: refactor how we delete one block group item")
Quoted 4 lines
It looks so awesome!!
I'm wondering how this is implemented? It would definitely help backporting not only to stable, but also some vendor backports branches.
Sasha's scripts generate these and put them online and you can do:
curl --fail --silent https://git.kernel.org/pub/scm/linux/kernel/git/sashal/deps.git/plain/v$STABLE_VERSION/$git_id
to query the dependancy tree.
thanks,
greg k-h