diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-12-31 19:41:45 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-01-05 23:24:20 -0500 |
commit | d55ddf6e7a81e1e72b2f73c3cca836a6961c68af (patch) | |
tree | 64236e2119de36ca0d778ac2870f4994621ccfbb /fs/bcachefs/chardev.c | |
parent | 1f34c21bc685f6bd43383aefcb85a9cf604d439a (diff) | |
download | linux-stable-d55ddf6e7a81e1e72b2f73c3cca836a6961c68af.tar.gz linux-stable-d55ddf6e7a81e1e72b2f73c3cca836a6961c68af.tar.bz2 linux-stable-d55ddf6e7a81e1e72b2f73c3cca836a6961c68af.zip |
bcachefs: Online fsck can now fix errors
BCH_FS_fsck_done -> BCH_FS_fsck_running; set when we might be fixing
fsck errors. Also; set fix_errors to ask by default when fsck is
running.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/chardev.c')
-rw-r--r-- | fs/bcachefs/chardev.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/fs/bcachefs/chardev.c b/fs/bcachefs/chardev.c index 46db563e0497..226b39c17667 100644 --- a/fs/bcachefs/chardev.c +++ b/fs/bcachefs/chardev.c @@ -774,15 +774,24 @@ static int bch2_fsck_online_thread_fn(void *arg) /* * XXX: can we figure out a way to do this without mucking with c->opts? */ + unsigned old_fix_errors = c->opts.fix_errors; if (opt_defined(thr->opts, fix_errors)) c->opts.fix_errors = thr->opts.fix_errors; + else + c->opts.fix_errors = FSCK_FIX_ask; + c->opts.fsck = true; + set_bit(BCH_FS_fsck_running, &c->flags); c->curr_recovery_pass = BCH_RECOVERY_PASS_check_alloc_info; - bch2_run_online_recovery_passes(c); + int ret = bch2_run_online_recovery_passes(c); + + clear_bit(BCH_FS_fsck_running, &c->flags); + bch_err_fn(c, ret); c->stdio = NULL; c->stdio_filter = NULL; + c->opts.fix_errors = old_fix_errors; thread_with_stdio_done(&thr->thr); |