From: Kent Overstreet Date: Wed, 26 Feb 2025 15:57:26 +0000 (-0500) Subject: bcachefs: Fix truncate sometimes failing and returning 1 X-Git-Tag: v6.14-rc5~25^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=eb54d2695b57426638fed0ec066ae17a18c4426c;p=thirdparty%2Flinux.git bcachefs: Fix truncate sometimes failing and returning 1 __bch_truncate_folio() may return 1 to indicate dirtyness of the folio being truncated, needed for fpunch to get the i_size writes correct. But truncate was forgetting to clear ret, and sometimes returning it as an error. Signed-off-by: Kent Overstreet --- diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c index 94bf34b9b65f0..717e7b94c66f8 100644 --- a/fs/bcachefs/fs-io.c +++ b/fs/bcachefs/fs-io.c @@ -466,6 +466,7 @@ int bchfs_truncate(struct mnt_idmap *idmap, ret = bch2_truncate_folio(inode, iattr->ia_size); if (unlikely(ret < 0)) goto err; + ret = 0; truncate_setsize(&inode->v, iattr->ia_size);