summaryrefslogtreecommitdiff
path: root/libbcachefs/fs-io.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbcachefs/fs-io.c')
-rw-r--r--libbcachefs/fs-io.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libbcachefs/fs-io.c b/libbcachefs/fs-io.c
index 160644cc..7f954a5d 100644
--- a/libbcachefs/fs-io.c
+++ b/libbcachefs/fs-io.c
@@ -2287,6 +2287,15 @@ int bch2_truncate(struct bch_inode_info *inode, struct iattr *iattr)
if (ret)
goto err;
+ /*
+ * check this before next assertion; on filesystem error our normal
+ * invariants are a bit broken (truncate has to truncate the page cache
+ * before the inode).
+ */
+ ret = bch2_journal_error(&c->journal);
+ if (ret)
+ goto err;
+
BUG_ON(inode->v.i_size < inode_u.bi_size);
if (iattr->ia_size > inode->v.i_size) {