diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2021-12-15 20:35:45 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2021-12-30 17:56:34 -0500 |
commit | cc57bfb6d4ae7ccd06962aaf7a2fcd3c6fe024db (patch) | |
tree | 1c826a4cf8f96164bc5d52d3f509682f2c5c401b | |
parent | 701ed7801ad9307a2d334ba8f315a3ab6f77bfd5 (diff) |
bcachefs: Fix an assertion in bch2_truncate()
We recently added an assertion that when we truncate a file to 0,
i_blocks should also go to 0 - but that's not necessarily true if we're
doing an emergency shutdown, lots of invariants no longer hold true in
that case.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
-rw-r--r-- | fs/bcachefs/fs-io.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c index 4ad843fa7e95..9cdd03f3eeb0 100644 --- a/fs/bcachefs/fs-io.c +++ b/fs/bcachefs/fs-io.c @@ -2705,7 +2705,8 @@ int bch2_truncate(struct user_namespace *mnt_userns, U64_MAX, &i_sectors_delta); i_sectors_acct(c, inode, NULL, i_sectors_delta); - BUG_ON(!inode->v.i_size && inode->v.i_blocks); + WARN_ON(!inode->v.i_size && inode->v.i_blocks && + !bch2_journal_error(&c->journal)); if (unlikely(ret)) goto err; |