summaryrefslogtreecommitdiff
path: root/fs/bcachefs/fs-io.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2021-12-16 04:35:45 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:09:18 +0300
commit51c4e406aa5706cdb224ff16eef1d560c504c3ac (patch)
tree1a2e25a3f385f6bc5b8019dcef7a3f5b485a76ac /fs/bcachefs/fs-io.c
parent2a863c6c80e3c14eb3920c0d8474ba112c82197a (diff)
downloadlinux-51c4e406aa5706cdb224ff16eef1d560c504c3ac.tar.xz
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>
Diffstat (limited to 'fs/bcachefs/fs-io.c')
-rw-r--r--fs/bcachefs/fs-io.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c
index 2f144fa3298d..28bbbac5cd67 100644
--- a/fs/bcachefs/fs-io.c
+++ b/fs/bcachefs/fs-io.c
@@ -2699,7 +2699,8 @@ int bch2_truncate(struct mnt_idmap *idmap,
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;