Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pnfs/blocklayout: fix last_write_offset incorrectly set to page boundary

Commit 41963c10c47a35185e68cb9049f7a3493c94d2d7 sets the block layout's
last written byte to the offset of the end of the extent rather than the
end of the write which incorrectly updates the inode's size for
partial-page writes.

Fixes: 41963c10c47a ("pnfs/blocklayout: update last_write_offset atomically with extents")
Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Tested-by: Christoph Hellwig <hch@lst.de>
Cc: stable@vger.kernel.org # 4.8+
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>

authored by

Benjamin Coddington and committed by
Anna Schumaker
a3f9d1b5 3f807e5a

+2 -1
+2 -1
fs/nfs/blocklayout/blocklayout.c
··· 344 344 u64 start = hdr->args.offset & (loff_t)PAGE_MASK; 345 345 u64 end = (hdr->args.offset + hdr->args.count + 346 346 PAGE_SIZE - 1) & (loff_t)PAGE_MASK; 347 + u64 lwb = hdr->args.offset + hdr->args.count; 347 348 348 349 ext_tree_mark_written(bl, start >> SECTOR_SHIFT, 349 - (end - start) >> SECTOR_SHIFT, end); 350 + (end - start) >> SECTOR_SHIFT, lwb); 350 351 } 351 352 352 353 pnfs_ld_write_done(hdr);