diff mbox series

fixup btrfs: relax block-group-tree feature dependency checks

Message ID 20220923072607.24584-1-wangyugui@e16-tech.com (mailing list archive)
State New, archived
Headers show
Series fixup btrfs: relax block-group-tree feature dependency checks | expand

Commit Message

Wang Yugui Sept. 23, 2022, 7:26 a.m. UTC
btrfs misc-next broken fstest btrfs/056.

dmesg output of fstests btrfs/056 failure.
[  658.119910] BTRFS error (device dm-0): cannot replay dirty log with unsupported compat_ro features (0x3), try rescue=nologreplay

there are 2 problems.
1) this error should not happen.
2) the message 'unsupported compat_ro features (0xXX)' should only output the unsupported part of compat_ro.

so fixup a4c79f3f1c2a (btrfs: relax block-group-tree feature dependency checks).

please fold it in because the orig patch is still in misc-next.

Signed-off-by: Wang Yugui <wangyugui@e16-tech.com>
---
 fs/btrfs/disk-io.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

Comments

Qu Wenruo Sept. 23, 2022, 8:23 a.m. UTC | #1
On 2022/9/23 15:26, Wang Yugui wrote:
> btrfs misc-next broken fstest btrfs/056.
>
> dmesg output of fstests btrfs/056 failure.
> [  658.119910] BTRFS error (device dm-0): cannot replay dirty log with unsupported compat_ro features (0x3), try rescue=nologreplay
>
> there are 2 problems.
> 1) this error should not happen.
> 2) the message 'unsupported compat_ro features (0xXX)' should only output the unsupported part of compat_ro.

The root problem is just the last check on log replay is checking all
compat_ro flags, not the unsupported one.

So the minimal fix is just to fix the last one with "&
~BTRFS_FEATURE_COMPAT_RO_SUPP" for the compat_ro value.

Anyway, thanks for the fix.

Thanks,
qu

>
> so fixup a4c79f3f1c2a (btrfs: relax block-group-tree feature dependency checks).
>
> please fold it in because the orig patch is still in misc-next.
>
> Signed-off-by: Wang Yugui <wangyugui@e16-tech.com>
> ---
>   fs/btrfs/disk-io.c | 14 ++++++++------
>   1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> index c10d368aed7b..9262d7af99b0 100644
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -3311,11 +3311,13 @@ int btrfs_check_features(struct btrfs_fs_info *fs_info, struct super_block *sb)
>   	struct btrfs_super_block *disk_super = fs_info->super_copy;
>   	u64 incompat = btrfs_super_incompat_flags(disk_super);
>   	u64 compat_ro = btrfs_super_compat_ro_flags(disk_super);
> +	u64 incompat_unsupp = incompat & ~BTRFS_FEATURE_INCOMPAT_SUPP;
> +	u64 compat_ro_unsupp = compat_ro & ~BTRFS_FEATURE_COMPAT_RO_SUPP;
>
> -	if (incompat & ~BTRFS_FEATURE_INCOMPAT_SUPP) {
> +	if (incompat_unsupp) {
>   		btrfs_err(fs_info,
>   		"cannot mount because of unknown incompat features (0x%llx)",
> -		    incompat);
> +		    incompat_unsupp);
>   		return -EINVAL;
>   	}
>
> @@ -3344,10 +3346,10 @@ int btrfs_check_features(struct btrfs_fs_info *fs_info, struct super_block *sb)
>   	if (btrfs_super_nodesize(disk_super) > PAGE_SIZE)
>   		incompat |= BTRFS_FEATURE_INCOMPAT_BIG_METADATA;
>
> -	if (compat_ro & ~BTRFS_FEATURE_COMPAT_RO_SUPP && !sb_rdonly(sb)) {
> +	if (compat_ro_unsupp && !sb_rdonly(sb)) {
>   		btrfs_err(fs_info,
>   	"cannot mount read-write because of unknown compat_ro features (0x%llx)",
> -		       compat_ro);
> +		       compat_ro_unsupp);
>   		return -EINVAL;
>   	}
>
> @@ -3356,11 +3358,11 @@ int btrfs_check_features(struct btrfs_fs_info *fs_info, struct super_block *sb)
>   	 * should not cause any metadata writes, including log replay.
>   	 * Or we could screw up whatever the new feature requires.
>   	 */
> -	if (compat_ro && btrfs_super_log_root(disk_super) &&
> +	if (compat_ro_unsupp && btrfs_super_log_root(disk_super) &&
>   	    !btrfs_test_opt(fs_info, NOLOGREPLAY)) {
>   		btrfs_err(fs_info,
>   "cannot replay dirty log with unsupported compat_ro features (0x%llx), try rescue=nologreplay",
> -			  compat_ro);
> +			  compat_ro_unsupp);
>   		return -EINVAL;
>   	}
>
David Sterba Sept. 23, 2022, 10:48 a.m. UTC | #2
On Fri, Sep 23, 2022 at 03:26:07PM +0800, Wang Yugui wrote:
> btrfs misc-next broken fstest btrfs/056.
> 
> dmesg output of fstests btrfs/056 failure.
> [  658.119910] BTRFS error (device dm-0): cannot replay dirty log with unsupported compat_ro features (0x3), try rescue=nologreplay
> 
> there are 2 problems.
> 1) this error should not happen.
> 2) the message 'unsupported compat_ro features (0xXX)' should only output the unsupported part of compat_ro.
> 
> so fixup a4c79f3f1c2a (btrfs: relax block-group-tree feature dependency checks).
> 
> please fold it in because the orig patch is still in misc-next.

Thank you, folded to the patch.
diff mbox series

Patch

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index c10d368aed7b..9262d7af99b0 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -3311,11 +3311,13 @@  int btrfs_check_features(struct btrfs_fs_info *fs_info, struct super_block *sb)
 	struct btrfs_super_block *disk_super = fs_info->super_copy;
 	u64 incompat = btrfs_super_incompat_flags(disk_super);
 	u64 compat_ro = btrfs_super_compat_ro_flags(disk_super);
+	u64 incompat_unsupp = incompat & ~BTRFS_FEATURE_INCOMPAT_SUPP;
+	u64 compat_ro_unsupp = compat_ro & ~BTRFS_FEATURE_COMPAT_RO_SUPP;
 
-	if (incompat & ~BTRFS_FEATURE_INCOMPAT_SUPP) {
+	if (incompat_unsupp) {
 		btrfs_err(fs_info,
 		"cannot mount because of unknown incompat features (0x%llx)",
-		    incompat);
+		    incompat_unsupp);
 		return -EINVAL;
 	}
 
@@ -3344,10 +3346,10 @@  int btrfs_check_features(struct btrfs_fs_info *fs_info, struct super_block *sb)
 	if (btrfs_super_nodesize(disk_super) > PAGE_SIZE)
 		incompat |= BTRFS_FEATURE_INCOMPAT_BIG_METADATA;
 
-	if (compat_ro & ~BTRFS_FEATURE_COMPAT_RO_SUPP && !sb_rdonly(sb)) {
+	if (compat_ro_unsupp && !sb_rdonly(sb)) {
 		btrfs_err(fs_info,
 	"cannot mount read-write because of unknown compat_ro features (0x%llx)",
-		       compat_ro);
+		       compat_ro_unsupp);
 		return -EINVAL;
 	}
 
@@ -3356,11 +3358,11 @@  int btrfs_check_features(struct btrfs_fs_info *fs_info, struct super_block *sb)
 	 * should not cause any metadata writes, including log replay.
 	 * Or we could screw up whatever the new feature requires.
 	 */
-	if (compat_ro && btrfs_super_log_root(disk_super) &&
+	if (compat_ro_unsupp && btrfs_super_log_root(disk_super) &&
 	    !btrfs_test_opt(fs_info, NOLOGREPLAY)) {
 		btrfs_err(fs_info,
 "cannot replay dirty log with unsupported compat_ro features (0x%llx), try rescue=nologreplay",
-			  compat_ro);
+			  compat_ro_unsupp);
 		return -EINVAL;
 	}