diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2019-03-31 19:23:34 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2019-03-31 19:25:20 -0400 |
commit | a0442e0549a95af2035286f39644c0cd8b84a76b (patch) | |
tree | e3e2ff8597f0b8521af416d6eca3a8c40f170cf4 | |
parent | b0f850cf91fc7f31fa0df4e66ace1e0631107d68 (diff) |
bcachefs: minor fsck fixbcachefs-v4.20
-rw-r--r-- | fs/bcachefs/fsck.c | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/fs/bcachefs/fsck.c b/fs/bcachefs/fsck.c index ceb38de9688b..b83f94c6a8d6 100644 --- a/fs/bcachefs/fsck.c +++ b/fs/bcachefs/fsck.c @@ -1239,12 +1239,10 @@ static int check_inode(struct btree_trans *trans, return ret; } - if (u.bi_flags & BCH_INODE_UNLINKED) { - fsck_err_on(c->sb.clean, c, - "filesystem marked clean, " - "but inode %llu unlinked", - u.bi_inum); - + if (u.bi_flags & BCH_INODE_UNLINKED && + (!c->sb.clean || + fsck_err(c, "filesystem marked clean, but inode %llu unlinked", + u.bi_inum))) { bch_verbose(c, "deleting inode %llu", u.bi_inum); ret = bch2_inode_rm(c, u.bi_inum); @@ -1254,12 +1252,10 @@ static int check_inode(struct btree_trans *trans, return ret; } - if (u.bi_flags & BCH_INODE_I_SIZE_DIRTY) { - fsck_err_on(c->sb.clean, c, - "filesystem marked clean, " - "but inode %llu has i_size dirty", - u.bi_inum); - + if (u.bi_flags & BCH_INODE_I_SIZE_DIRTY && + (!c->sb.clean || + fsck_err(c, "filesystem marked clean, but inode %llu has i_size dirty", + u.bi_inum))) { bch_verbose(c, "truncating inode %llu", u.bi_inum); /* @@ -1284,14 +1280,12 @@ static int check_inode(struct btree_trans *trans, do_update = true; } - if (u.bi_flags & BCH_INODE_I_SECTORS_DIRTY) { + if (u.bi_flags & BCH_INODE_I_SECTORS_DIRTY && + (!c->sb.clean || + fsck_err(c, "filesystem marked clean, but inode %llu has i_sectors dirty", + u.bi_inum))) { s64 sectors; - fsck_err_on(c->sb.clean, c, - "filesystem marked clean, " - "but inode %llu has i_sectors dirty", - u.bi_inum); - bch_verbose(c, "recounting sectors for inode %llu", u.bi_inum); |