mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
bcachefs: Fix fsck warnings from bkey validation
__bch2_fsck_err() warns if the current task has a btree_trans object and it wasn't passed in, because if it has to prompt for user input it has to be able to unlock it. But plumbing the btree_trans through bkey_validate(), as well as transaction restarts, is problematic - so instead make bkey fsck errors FSCK_AUTOFIX, which doesn't need to warn. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
7c980a43e9
commit
5612daafb7
2 changed files with 14 additions and 2 deletions
|
@ -239,7 +239,19 @@ int __bch2_fsck_err(struct bch_fs *c,
|
||||||
if (!c)
|
if (!c)
|
||||||
c = trans->c;
|
c = trans->c;
|
||||||
|
|
||||||
WARN_ON(!trans && bch2_current_has_btree_trans(c));
|
/*
|
||||||
|
* Ugly: if there's a transaction in the current task it has to be
|
||||||
|
* passed in to unlock if we prompt for user input.
|
||||||
|
*
|
||||||
|
* But, plumbing a transaction and transaction restarts into
|
||||||
|
* bkey_validate() is problematic.
|
||||||
|
*
|
||||||
|
* So:
|
||||||
|
* - make all bkey errors AUTOFIX, they're simple anyways (we just
|
||||||
|
* delete the key)
|
||||||
|
* - and we don't need to warn if we're not prompting
|
||||||
|
*/
|
||||||
|
WARN_ON(!(flags & FSCK_AUTOFIX) && !trans && bch2_current_has_btree_trans(c));
|
||||||
|
|
||||||
if ((flags & FSCK_CAN_FIX) &&
|
if ((flags & FSCK_CAN_FIX) &&
|
||||||
test_bit(err, c->sb.errors_silent))
|
test_bit(err, c->sb.errors_silent))
|
||||||
|
|
|
@ -184,7 +184,7 @@ do { \
|
||||||
ret = -BCH_ERR_fsck_delete_bkey; \
|
ret = -BCH_ERR_fsck_delete_bkey; \
|
||||||
goto fsck_err; \
|
goto fsck_err; \
|
||||||
} \
|
} \
|
||||||
int _ret = __bch2_bkey_fsck_err(c, k, FSCK_CAN_FIX, \
|
int _ret = __bch2_bkey_fsck_err(c, k, FSCK_CAN_FIX|FSCK_AUTOFIX,\
|
||||||
BCH_FSCK_ERR_##_err_type, \
|
BCH_FSCK_ERR_##_err_type, \
|
||||||
_err_msg, ##__VA_ARGS__); \
|
_err_msg, ##__VA_ARGS__); \
|
||||||
if (_ret != -BCH_ERR_fsck_fix && \
|
if (_ret != -BCH_ERR_fsck_fix && \
|
||||||
|
|
Loading…
Add table
Reference in a new issue