Skip to content

Commit 05801b6

Browse files
author
Kent Overstreet
committed
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>
1 parent 374b3d3 commit 05801b6

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

fs/bcachefs/chardev.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,10 @@ static long bch2_ioctl_fsck_offline(struct bch_ioctl_fsck_offline __user *user_a
234234

235235
thr->c = bch2_fs_open(devs.data, arg.nr_devs, thr->opts);
236236

237+
if (!IS_ERR(thr->c) &&
238+
thr->c->opts.errors == BCH_ON_ERROR_panic)
239+
thr->c->opts.errors = BCH_ON_ERROR_ro;
240+
237241
ret = bch2_run_thread_with_stdio(&thr->thr, &bch2_offline_fsck_ops);
238242
out:
239243
darray_for_each(devs, i)

0 commit comments

Comments
 (0)