Commit ff872b76 authored by Linus Torvalds's avatar Linus Torvalds

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
parents cb78d1b5 e3a4167c
...@@ -4632,6 +4632,17 @@ void __cold close_ctree(struct btrfs_fs_info *fs_info) ...@@ -4632,6 +4632,17 @@ void __cold close_ctree(struct btrfs_fs_info *fs_info)
int ret; int ret;
set_bit(BTRFS_FS_CLOSING_START, &fs_info->flags); set_bit(BTRFS_FS_CLOSING_START, &fs_info->flags);
/*
* We may have the reclaim task running and relocating a data block group,
* in which case it may create delayed iputs. So stop it before we park
* the cleaner kthread otherwise we can get new delayed iputs after
* parking the cleaner, and that can make the async reclaim task to hang
* if it's waiting for delayed iputs to complete, since the cleaner is
* parked and can not run delayed iputs - this will make us hang when
* trying to stop the async reclaim task.
*/
cancel_work_sync(&fs_info->reclaim_bgs_work);
/* /*
* We don't want the cleaner to start new transactions, add more delayed * We don't want the cleaner to start new transactions, add more delayed
* iputs, etc. while we're closing. We can't use kthread_stop() yet * 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) ...@@ -4672,8 +4683,6 @@ void __cold close_ctree(struct btrfs_fs_info *fs_info)
cancel_work_sync(&fs_info->async_data_reclaim_work); cancel_work_sync(&fs_info->async_data_reclaim_work);
cancel_work_sync(&fs_info->preempt_reclaim_work); cancel_work_sync(&fs_info->preempt_reclaim_work);
cancel_work_sync(&fs_info->reclaim_bgs_work);
/* Cancel or finish ongoing discard work */ /* Cancel or finish ongoing discard work */
btrfs_discard_cleanup(fs_info); btrfs_discard_cleanup(fs_info);
......
...@@ -763,6 +763,8 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options, ...@@ -763,6 +763,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;
} }
...@@ -821,8 +823,11 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options, ...@@ -821,8 +823,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;
} }
...@@ -883,8 +888,11 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options, ...@@ -883,8 +888,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);
...@@ -901,6 +909,8 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options, ...@@ -901,6 +909,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;
} }
...@@ -933,6 +943,8 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options, ...@@ -933,6 +943,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;
} }
...@@ -1014,8 +1026,12 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options, ...@@ -1014,8 +1026,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);
...@@ -1030,13 +1046,15 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options, ...@@ -1030,13 +1046,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;
} }
...@@ -1044,8 +1062,12 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options, ...@@ -1044,8 +1062,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",
...@@ -1059,8 +1081,11 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options, ...@@ -1059,8 +1081,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:
...@@ -1985,6 +2010,14 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data) ...@@ -1985,6 +2010,14 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
if (ret) if (ret)
goto restore; goto restore;
/* V1 cache is not supported for subpage mount. */
if (fs_info->sectorsize < PAGE_SIZE && btrfs_test_opt(fs_info, SPACE_CACHE)) {
btrfs_warn(fs_info,
"v1 space cache is not supported for page size %lu with sectorsize %u",
PAGE_SIZE, fs_info->sectorsize);
ret = -EINVAL;
goto restore;
}
btrfs_remount_begin(fs_info, old_opts, *flags); btrfs_remount_begin(fs_info, old_opts, *flags);
btrfs_resize_thread_pool(fs_info, btrfs_resize_thread_pool(fs_info,
fs_info->thread_pool_size, old_thread_pool_size); fs_info->thread_pool_size, old_thread_pool_size);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment