mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-02-23 00:00:02 +03:00
Return errors from fsck properly
This commit is contained in:
parent
76a549d82d
commit
b5094ee854
@ -23,7 +23,7 @@ static void usage(void)
|
|||||||
int cmd_fsck(int argc, char *argv[])
|
int cmd_fsck(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
struct bch_opts opts = bch2_opts_empty();
|
struct bch_opts opts = bch2_opts_empty();
|
||||||
int opt;
|
int opt, ret = 0;
|
||||||
|
|
||||||
opt_set(opts, degraded, true);
|
opt_set(opts, degraded, true);
|
||||||
opt_set(opts, fix_errors, FSCK_OPT_ASK);
|
opt_set(opts, fix_errors, FSCK_OPT_ASK);
|
||||||
@ -60,6 +60,11 @@ int cmd_fsck(int argc, char *argv[])
|
|||||||
if (IS_ERR(c))
|
if (IS_ERR(c))
|
||||||
die("error opening %s: %s", argv[0], strerror(-PTR_ERR(c)));
|
die("error opening %s: %s", argv[0], strerror(-PTR_ERR(c)));
|
||||||
|
|
||||||
|
if (test_bit(BCH_FS_FSCK_FIXED_ERRORS, &c->flags))
|
||||||
|
ret = 2;
|
||||||
|
if (test_bit(BCH_FS_FSCK_UNFIXED_ERRORS, &c->flags))
|
||||||
|
ret = 4;
|
||||||
|
|
||||||
bch2_fs_stop(c);
|
bch2_fs_stop(c);
|
||||||
return 0;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user