]> www.infradead.org Git - users/willy/pagecache.git/commitdiff
bcachefs: Fix truncate sometimes failing and returning 1
authorKent Overstreet <kent.overstreet@linux.dev>
Wed, 26 Feb 2025 15:57:26 +0000 (10:57 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Thu, 27 Feb 2025 00:31:05 +0000 (19:31 -0500)
__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 <kent.overstreet@linux.dev>
fs/bcachefs/fs-io.c

index 94bf34b9b65f06cebd02a3fc06497af8bc6162b1..717e7b94c66f87a9bd3ea10f449940886bbac2ce 100644 (file)
@@ -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);