diff mbox

[1/3] btrfs: fail mount when sb flag is not in BTRFS_SUPER_FLAG_SUPP

Message ID 20180108080421.17668-2-anand.jain@oracle.com (mailing list archive)
State New, archived
Headers show

Commit Message

Anand Jain Jan. 8, 2018, 8:04 a.m. UTC
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
---
 fs/btrfs/disk-io.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Qu Wenruo Jan. 8, 2018, 8:17 a.m. UTC | #1
On 2018年01月08日 16:04, Anand Jain wrote:
> 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

The patch itself is good.

But it should be the last patch, to avoid breaking bisect.

With that fixed, feel free to add my tag:

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu

> ---
>  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 a69e5944dc08..b04da740a9a2 100644
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -3906,9 +3906,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);
>
diff mbox

Patch

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index a69e5944dc08..b04da740a9a2 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -3906,9 +3906,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);