Skip to content

Commit ff872b7

Browse files
committed
Merge tag 'for-5.19-rc3-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux
Pull btrfs fixes from David Sterba: - print more error messages for invalid mount option values - prevent remount with v1 space cache for subpage filesystem - fix hang during unmount when block group reclaim task is running * tag 'for-5.19-rc3-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux: btrfs: add error messages to all unrecognized mount options btrfs: prevent remounting to v1 space cache for subpage mount btrfs: fix hang during unmount when block group reclaim task is running
2 parents cb78d1b + e3a4167 commit ff872b7

File tree

2 files changed

+51
-9
lines changed

2 files changed

+51
-9
lines changed

fs/btrfs/disk-io.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4632,6 +4632,17 @@ void __cold close_ctree(struct btrfs_fs_info *fs_info)
46324632
int ret;
46334633

46344634
set_bit(BTRFS_FS_CLOSING_START, &fs_info->flags);
4635+
4636+
/*
4637+
* We may have the reclaim task running and relocating a data block group,
4638+
* in which case it may create delayed iputs. So stop it before we park
4639+
* the cleaner kthread otherwise we can get new delayed iputs after
4640+
* parking the cleaner, and that can make the async reclaim task to hang
4641+
* if it's waiting for delayed iputs to complete, since the cleaner is
4642+
* parked and can not run delayed iputs - this will make us hang when
4643+
* trying to stop the async reclaim task.
4644+
*/
4645+
cancel_work_sync(&fs_info->reclaim_bgs_work);
46354646
/*
46364647
* We don't want the cleaner to start new transactions, add more delayed
46374648
* iputs, etc. while we're closing. We can't use kthread_stop() yet
@@ -4672,8 +4683,6 @@ void __cold close_ctree(struct btrfs_fs_info *fs_info)
46724683
cancel_work_sync(&fs_info->async_data_reclaim_work);
46734684
cancel_work_sync(&fs_info->preempt_reclaim_work);
46744685

4675-
cancel_work_sync(&fs_info->reclaim_bgs_work);
4676-
46774686
/* Cancel or finish ongoing discard work */
46784687
btrfs_discard_cleanup(fs_info);
46794688

fs/btrfs/super.c

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,8 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
763763
compress_force = false;
764764
no_compress++;
765765
} else {
766+
btrfs_err(info, "unrecognized compression value %s",
767+
args[0].from);
766768
ret = -EINVAL;
767769
goto out;
768770
}
@@ -821,8 +823,11 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
821823
case Opt_thread_pool:
822824
ret = match_int(&args[0], &intarg);
823825
if (ret) {
826+
btrfs_err(info, "unrecognized thread_pool value %s",
827+
args[0].from);
824828
goto out;
825829
} else if (intarg == 0) {
830+
btrfs_err(info, "invalid value 0 for thread_pool");
826831
ret = -EINVAL;
827832
goto out;
828833
}
@@ -883,8 +888,11 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
883888
break;
884889
case Opt_ratio:
885890
ret = match_int(&args[0], &intarg);
886-
if (ret)
891+
if (ret) {
892+
btrfs_err(info, "unrecognized metadata_ratio value %s",
893+
args[0].from);
887894
goto out;
895+
}
888896
info->metadata_ratio = intarg;
889897
btrfs_info(info, "metadata ratio %u",
890898
info->metadata_ratio);
@@ -901,6 +909,8 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
901909
btrfs_set_and_info(info, DISCARD_ASYNC,
902910
"turning on async discard");
903911
} else {
912+
btrfs_err(info, "unrecognized discard mode value %s",
913+
args[0].from);
904914
ret = -EINVAL;
905915
goto out;
906916
}
@@ -933,6 +943,8 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
933943
btrfs_set_and_info(info, FREE_SPACE_TREE,
934944
"enabling free space tree");
935945
} else {
946+
btrfs_err(info, "unrecognized space_cache value %s",
947+
args[0].from);
936948
ret = -EINVAL;
937949
goto out;
938950
}
@@ -1014,8 +1026,12 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
10141026
break;
10151027
case Opt_check_integrity_print_mask:
10161028
ret = match_int(&args[0], &intarg);
1017-
if (ret)
1029+
if (ret) {
1030+
btrfs_err(info,
1031+
"unrecognized check_integrity_print_mask value %s",
1032+
args[0].from);
10181033
goto out;
1034+
}
10191035
info->check_integrity_print_mask = intarg;
10201036
btrfs_info(info, "check_integrity_print_mask 0x%x",
10211037
info->check_integrity_print_mask);
@@ -1030,22 +1046,28 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
10301046
goto out;
10311047
#endif
10321048
case Opt_fatal_errors:
1033-
if (strcmp(args[0].from, "panic") == 0)
1049+
if (strcmp(args[0].from, "panic") == 0) {
10341050
btrfs_set_opt(info->mount_opt,
10351051
PANIC_ON_FATAL_ERROR);
1036-
else if (strcmp(args[0].from, "bug") == 0)
1052+
} else if (strcmp(args[0].from, "bug") == 0) {
10371053
btrfs_clear_opt(info->mount_opt,
10381054
PANIC_ON_FATAL_ERROR);
1039-
else {
1055+
} else {
1056+
btrfs_err(info, "unrecognized fatal_errors value %s",
1057+
args[0].from);
10401058
ret = -EINVAL;
10411059
goto out;
10421060
}
10431061
break;
10441062
case Opt_commit_interval:
10451063
intarg = 0;
10461064
ret = match_int(&args[0], &intarg);
1047-
if (ret)
1065+
if (ret) {
1066+
btrfs_err(info, "unrecognized commit_interval value %s",
1067+
args[0].from);
1068+
ret = -EINVAL;
10481069
goto out;
1070+
}
10491071
if (intarg == 0) {
10501072
btrfs_info(info,
10511073
"using default commit interval %us",
@@ -1059,8 +1081,11 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
10591081
break;
10601082
case Opt_rescue:
10611083
ret = parse_rescue_options(info, args[0].from);
1062-
if (ret < 0)
1084+
if (ret < 0) {
1085+
btrfs_err(info, "unrecognized rescue value %s",
1086+
args[0].from);
10631087
goto out;
1088+
}
10641089
break;
10651090
#ifdef CONFIG_BTRFS_DEBUG
10661091
case Opt_fragment_all:
@@ -1985,6 +2010,14 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
19852010
if (ret)
19862011
goto restore;
19872012

2013+
/* V1 cache is not supported for subpage mount. */
2014+
if (fs_info->sectorsize < PAGE_SIZE && btrfs_test_opt(fs_info, SPACE_CACHE)) {
2015+
btrfs_warn(fs_info,
2016+
"v1 space cache is not supported for page size %lu with sectorsize %u",
2017+
PAGE_SIZE, fs_info->sectorsize);
2018+
ret = -EINVAL;
2019+
goto restore;
2020+
}
19882021
btrfs_remount_begin(fs_info, old_opts, *flags);
19892022
btrfs_resize_thread_pool(fs_info,
19902023
fs_info->thread_pool_size, old_thread_pool_size);

0 commit comments

Comments
 (0)