diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c index 5beb47805a68..c30c028c869d 100644 --- a/fs/bcachefs/fs-io.c +++ b/fs/bcachefs/fs-io.c @@ -2255,6 +2255,15 @@ int bch2_truncate(struct bch_inode_info *inode, struct iattr *iattr) ret = PTR_ERR_OR_ZERO(iter); bch2_trans_exit(&trans); + 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;