aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2024-04-05 22:30:30 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2024-04-06 13:50:25 -0400
commit05801b6526156aefe55c0440fab877109c9a89c5 (patch)
tree61bed46f185cbf038df837c7d265ee3e0183c7ea /fs
parent374b3d38feff4a1cb4ecadace9bd915ffd91fe4b (diff)
downloadlinux-05801b6526156aefe55c0440fab877109c9a89c5.tar.gz
bcachefs: Disable errors=panic for BCH_IOCTL_FSCK_OFFLINE
BCH_IOCTL_FSCK_OFFLINE allows the userspace fsck tool to use the kernel implementation of fsck - primarily when the kernel version is a better version match. It should look and act exactly like the normal userspace fsck that the user expected to be invoking, so errors should never result in a kernel panic. We may want to consider further restricting errors=panic - it's only intended for debugging in controlled test environments, it should have no purpose it normal usage. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs')
-rw-r--r--fs/bcachefs/chardev.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/bcachefs/chardev.c b/fs/bcachefs/chardev.c
index 1e033df330b0da..72781aad6ba70c 100644
--- a/fs/bcachefs/chardev.c
+++ b/fs/bcachefs/chardev.c
@@ -234,6 +234,10 @@ static long bch2_ioctl_fsck_offline(struct bch_ioctl_fsck_offline __user *user_a
thr->c = bch2_fs_open(devs.data, arg.nr_devs, thr->opts);
+ if (!IS_ERR(thr->c) &&
+ thr->c->opts.errors == BCH_ON_ERROR_panic)
+ thr->c->opts.errors = BCH_ON_ERROR_ro;
+
ret = bch2_run_thread_with_stdio(&thr->thr, &bch2_offline_fsck_ops);
out:
darray_for_each(devs, i)