Skip to contentSkip to conversation

fuse: remove page alignment check for writeback len

PATCH In review Joanne Koong 3 participants 3 messages Jul 23, 2025 – Jul 24, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fuse: remove page alignment check for writeback len

Remove incorrect page alignment check for the writeback len arg in fuse_iomap_writeback_range(). len will always be block-aligned as passed in by iomap. On regular fuse filesystems, i_blkbits is set to PAGE_SHIFT so this is not a problem but for fuseblk filesystems, the block size is set to a default of 512 bytes or a block size passed in at mount time.

Please note that non-page-aligned lens are fine for the logic in fuse_iomap_writeback_range(). The check was originally added as a safeguard to detect conspicuously wrong ranges.

Fixes ef7e7cbb323f ("fuse: use iomap for writeback")

[1] report:
https://lore.kernel.org/linux-fsdevel/CA+G9fYs5AdVM-T2Tf3LciNCwLZEHetcnSkHsjZajVwwpM2HmJw@mail.gmail.com/

---
 fs/fuse/file.c | 2 --
 1 file changed, 2 deletions(-)
fs/fuse/file.c +0 -2
index f16426fd2bf5..883dc94a0ce0 100644
@@ -2155,8 +2155,6 @@ static ssize_t fuse_iomap_writeback_range(struct iomap_writepage_ctx *wpc,
 	loff_t offset = offset_in_folio(folio, pos);
 
 	WARN_ON_ONCE(!data);
-	/* len will always be page aligned */
-	WARN_ON_ONCE(len & (PAGE_SIZE - 1));
 
 	if (!data->ff) {
 		data->ff = fuse_write_file_get(fi);
Signature · 1 line
2.47.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Joanne Koong

Remove incorrect page alignment check for the writeback len arg in fuse_iomap_writeback_range(). len will always be block-aligned as passed in by iomap. On regular fuse filesystems, i_blkbits is set to PAGE_SHIFT so this is not a problem but for fuseblk filesystems, the block size is set to a default of 512 bytes or a block size passed in at mount time.

Quoted 7 lines

Please note that non-page-aligned lens are fine for the logic in fuse_iomap_writeback_range(). The check was originally added as a safeguard to detect conspicuously wrong ranges.

Fixes ef7e7cbb323f ("fuse: use iomap for writeback")

Seems fine to me,

--D

Quoted 24 lines

[1] report:
https://lore.kernel.org/linux-fsdevel/CA+G9fYs5AdVM-T2Tf3LciNCwLZEHetcnSkHsjZajVwwpM2HmJw@mail.gmail.com/

---
 fs/fuse/file.c | 2 --
 1 file changed, 2 deletions(-)
fs/fuse/file.c +0 -2
index f16426fd2bf5..883dc94a0ce0 100644
@@ -2155,8 +2155,6 @@ static ssize_t fuse_iomap_writeback_range(struct iomap_writepage_ctx *wpc,
 	loff_t offset = offset_in_folio(folio, pos);
 
 	WARN_ON_ONCE(!data);
-	/* len will always be page aligned */
-	WARN_ON_ONCE(len & (PAGE_SIZE - 1));
 
 	if (!data->ff) {
 		data->ff = fuse_write_file_get(fi);
Signature · 1 line
2.47.3
Tested-by Linux Kernel Functional Testing
#2 lore raw
Quoted 8 lines · Darrick J. Wong
Quoted 6 lines · Joanne Koong

Remove incorrect page alignment check for the writeback len arg in fuse_iomap_writeback_range(). len will always be block-aligned as passed in by iomap. On regular fuse filesystems, i_blkbits is set to PAGE_SHIFT so this is not a problem but for fuseblk filesystems, the block size is set to a default of 512 bytes or a block size passed in at mount time.

Quoted 7 lines
Quoted 7 lines

Please note that non-page-aligned lens are fine for the logic in fuse_iomap_writeback_range(). The check was originally added as a safeguard to detect conspicuously wrong ranges.

Fixes ef7e7cbb323f ("fuse: use iomap for writeback")

I have applied this patch on top of the Linux next tree and performed testing. The previously reported regressions [1] are no longer observed. Thank you for providing the fix.

Quoted 7 lines

Seems fine to me,

--D

Quoted 1 line

[1] report:
https://lore.kernel.org/linux-fsdevel/CA+G9fYs5AdVM-T2Tf3LciNCwLZEHetcnSkHsjZajVwwpM2HmJw@mail.gmail.com/

Quoted 15 lines
Quoted 15 lines
---
 fs/fuse/file.c | 2 --
 1 file changed, 2 deletions(-)
fs/fuse/file.c +0 -2
index f16426fd2bf5..883dc94a0ce0 100644
@@ -2155,8 +2155,6 @@ static ssize_t fuse_iomap_writeback_range(struct iomap_writepage_ctx *wpc,
      loff_t offset = offset_in_folio(folio, pos);
 
      WARN_ON_ONCE(!data);
-     /* len will always be page aligned */
-     WARN_ON_ONCE(len & (PAGE_SIZE - 1));
 
Quoted 6 lines
Quoted 6 lines
fs/fuse/file.c +0 -1
      if (!data->ff) {
              data->ff = fuse_write_file_get(fi);
--

2.47.3

--
Linaro LKFT
https://lkft.linaro.org