linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joanne Koong <joannelkoong@gmail.com>
To: brauner@kernel.org
Cc: miklos@szeredi.hu, djwong@kernel.org,
	linux-fsdevel@vger.kernel.org,  kernel-team@meta.com
Subject: Re: [PATCH] fuse: fix fuseblk i_blkbits for iomap partial writes
Date: Tue, 12 Aug 2025 15:47:16 -0700	[thread overview]
Message-ID: <CAJnrk1ZYZmr4yne25WV7LjOTptb2OTarZ23Tf7gfZUk4aSwppA@mail.gmail.com> (raw)
In-Reply-To: <20250812014623.2408476-1-joannelkoong@gmail.com>

On Mon, Aug 11, 2025 at 6:49 PM Joanne Koong <joannelkoong@gmail.com> 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@gmail.com>
> 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@gmail.com/T/#t

Thanks,
Joanne

      reply	other threads:[~2025-08-12 22:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-12  1:46 [PATCH] fuse: fix fuseblk i_blkbits for iomap partial writes Joanne Koong
2025-08-12 22:47 ` Joanne Koong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJnrk1ZYZmr4yne25WV7LjOTptb2OTarZ23Tf7gfZUk4aSwppA@mail.gmail.com \
    --to=joannelkoong@gmail.com \
    --cc=brauner@kernel.org \
    --cc=djwong@kernel.org \
    --cc=kernel-team@meta.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).