On Mon, Aug 11, 2025 at 6:49 PM Joanne Koong <joannelkoong@xxxxxxxxx> wrote: > > On regular fuse filesystems, i_blkbits is set to PAGE_SHIFT which means > any iomap partial writes will mark the entire folio as uptodate. However > fuseblk filesystems work differently and allow the blocksize to be less > than the page size. As such, this may lead to data corruption if fuseblk > sets its blocksize to less than the page size, uses the writeback cache, > and does a partial write, then a read and the read happens before the > write has undergone writeback, since the folio will not be marked > uptodate from the partial write so the read will read in the entire > folio from disk, which will overwrite the partial write. > > The long-term solution for this, which will also be needed for fuse to > enable large folios with the writeback cache on, is to have fuse also > use iomap for folio reads, but until that is done, the cleanest > workaround is to use the page size for fuseblk's internal kernel > blksize/blkbits values while maintaining current behavior for stat(). > > This was verified using ntfs-3g: > $ sudo mkfs.ntfs -f -c 512 /dev/vdd1 > $ sudo ntfs-3g /dev/vdd1 ~/fuseblk > $ stat ~/fuseblk/hi.txt > IO Block: 512 > > Signed-off-by: Joanne Koong <joannelkoong@xxxxxxxxx> > Fixes: a4c9ab1d4975 ("fuse: use iomap for buffered writes") Please ignore this version of the patch. This is superseded by the newer version here: https://lore.kernel.org/linux-fsdevel/20250812214614.2674485-1-joannelkoong@xxxxxxxxx/T/#t Thanks, Joanne