mirror of
https://github.com/torvalds/linux.git
synced 2026-06-06 13:37:36 +02:00
btrfs: add error messages to all unrecognized mount options
commit e3a4167c88 upstream.
Almost none of the errors stemming from a valid mount option but wrong
value prints a descriptive message which would help to identify why
mount failed. Like in the linked report:
$ uname -r
v4.19
$ mount -o compress=zstd /dev/sdb /mnt
mount: /mnt: wrong fs type, bad option, bad superblock on
/dev/sdb, missing codepage or helper program, or other error.
$ dmesg
...
BTRFS error (device sdb): open_ctree failed
Errors caused by memory allocation failures are left out as it's not a
user error so reporting that would be confusing.
Link: https://lore.kernel.org/linux-btrfs/9c3fec36-fc61-3a33-4977-a7e207c3fa4e@gmx.de/
CC: stable@vger.kernel.org # 4.9+
Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
49e3e449bc
commit
0ae82e1ccb
|
|
@ -652,6 +652,8 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
|
||||||
compress_force = false;
|
compress_force = false;
|
||||||
no_compress++;
|
no_compress++;
|
||||||
} else {
|
} else {
|
||||||
|
btrfs_err(info, "unrecognized compression value %s",
|
||||||
|
args[0].from);
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
@ -710,8 +712,11 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
|
||||||
case Opt_thread_pool:
|
case Opt_thread_pool:
|
||||||
ret = match_int(&args[0], &intarg);
|
ret = match_int(&args[0], &intarg);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
btrfs_err(info, "unrecognized thread_pool value %s",
|
||||||
|
args[0].from);
|
||||||
goto out;
|
goto out;
|
||||||
} else if (intarg == 0) {
|
} else if (intarg == 0) {
|
||||||
|
btrfs_err(info, "invalid value 0 for thread_pool");
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
@ -772,8 +777,11 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
|
||||||
break;
|
break;
|
||||||
case Opt_ratio:
|
case Opt_ratio:
|
||||||
ret = match_int(&args[0], &intarg);
|
ret = match_int(&args[0], &intarg);
|
||||||
if (ret)
|
if (ret) {
|
||||||
|
btrfs_err(info, "unrecognized metadata_ratio value %s",
|
||||||
|
args[0].from);
|
||||||
goto out;
|
goto out;
|
||||||
|
}
|
||||||
info->metadata_ratio = intarg;
|
info->metadata_ratio = intarg;
|
||||||
btrfs_info(info, "metadata ratio %u",
|
btrfs_info(info, "metadata ratio %u",
|
||||||
info->metadata_ratio);
|
info->metadata_ratio);
|
||||||
|
|
@ -790,6 +798,8 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
|
||||||
btrfs_set_and_info(info, DISCARD_ASYNC,
|
btrfs_set_and_info(info, DISCARD_ASYNC,
|
||||||
"turning on async discard");
|
"turning on async discard");
|
||||||
} else {
|
} else {
|
||||||
|
btrfs_err(info, "unrecognized discard mode value %s",
|
||||||
|
args[0].from);
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
@ -814,6 +824,8 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
|
||||||
btrfs_set_and_info(info, FREE_SPACE_TREE,
|
btrfs_set_and_info(info, FREE_SPACE_TREE,
|
||||||
"enabling free space tree");
|
"enabling free space tree");
|
||||||
} else {
|
} else {
|
||||||
|
btrfs_err(info, "unrecognized space_cache value %s",
|
||||||
|
args[0].from);
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
@ -889,8 +901,12 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
|
||||||
break;
|
break;
|
||||||
case Opt_check_integrity_print_mask:
|
case Opt_check_integrity_print_mask:
|
||||||
ret = match_int(&args[0], &intarg);
|
ret = match_int(&args[0], &intarg);
|
||||||
if (ret)
|
if (ret) {
|
||||||
|
btrfs_err(info,
|
||||||
|
"unrecognized check_integrity_print_mask value %s",
|
||||||
|
args[0].from);
|
||||||
goto out;
|
goto out;
|
||||||
|
}
|
||||||
info->check_integrity_print_mask = intarg;
|
info->check_integrity_print_mask = intarg;
|
||||||
btrfs_info(info, "check_integrity_print_mask 0x%x",
|
btrfs_info(info, "check_integrity_print_mask 0x%x",
|
||||||
info->check_integrity_print_mask);
|
info->check_integrity_print_mask);
|
||||||
|
|
@ -905,13 +921,15 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
|
||||||
goto out;
|
goto out;
|
||||||
#endif
|
#endif
|
||||||
case Opt_fatal_errors:
|
case Opt_fatal_errors:
|
||||||
if (strcmp(args[0].from, "panic") == 0)
|
if (strcmp(args[0].from, "panic") == 0) {
|
||||||
btrfs_set_opt(info->mount_opt,
|
btrfs_set_opt(info->mount_opt,
|
||||||
PANIC_ON_FATAL_ERROR);
|
PANIC_ON_FATAL_ERROR);
|
||||||
else if (strcmp(args[0].from, "bug") == 0)
|
} else if (strcmp(args[0].from, "bug") == 0) {
|
||||||
btrfs_clear_opt(info->mount_opt,
|
btrfs_clear_opt(info->mount_opt,
|
||||||
PANIC_ON_FATAL_ERROR);
|
PANIC_ON_FATAL_ERROR);
|
||||||
else {
|
} else {
|
||||||
|
btrfs_err(info, "unrecognized fatal_errors value %s",
|
||||||
|
args[0].from);
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
@ -919,8 +937,12 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
|
||||||
case Opt_commit_interval:
|
case Opt_commit_interval:
|
||||||
intarg = 0;
|
intarg = 0;
|
||||||
ret = match_int(&args[0], &intarg);
|
ret = match_int(&args[0], &intarg);
|
||||||
if (ret)
|
if (ret) {
|
||||||
|
btrfs_err(info, "unrecognized commit_interval value %s",
|
||||||
|
args[0].from);
|
||||||
|
ret = -EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
|
}
|
||||||
if (intarg == 0) {
|
if (intarg == 0) {
|
||||||
btrfs_info(info,
|
btrfs_info(info,
|
||||||
"using default commit interval %us",
|
"using default commit interval %us",
|
||||||
|
|
@ -934,8 +956,11 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
|
||||||
break;
|
break;
|
||||||
case Opt_rescue:
|
case Opt_rescue:
|
||||||
ret = parse_rescue_options(info, args[0].from);
|
ret = parse_rescue_options(info, args[0].from);
|
||||||
if (ret < 0)
|
if (ret < 0) {
|
||||||
|
btrfs_err(info, "unrecognized rescue value %s",
|
||||||
|
args[0].from);
|
||||||
goto out;
|
goto out;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
#ifdef CONFIG_BTRFS_DEBUG
|
#ifdef CONFIG_BTRFS_DEBUG
|
||||||
case Opt_fragment_all:
|
case Opt_fragment_all:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user