]> www.infradead.org Git - users/willy/xarray.git/commit
xfs: ensure st_blocks never goes to zero during COW writes
authorChristoph Hellwig <hch@lst.de>
Tue, 27 Aug 2024 05:03:21 +0000 (07:03 +0200)
committerChandan Babu R <chandanbabu@kernel.org>
Tue, 3 Sep 2024 04:37:47 +0000 (10:07 +0530)
commit90fa22da6d6b41dc17435aff7b800f9ca3c00401
treebc4a367116c258848a798c59857aa6b3f66c3e1e
parent866cf1dd3d5cc03e6544a9582ef9c79ecdfc92c0
xfs: ensure st_blocks never goes to zero during COW writes

COW writes remove the amount overwritten either directly for delalloc
reservations, or in earlier deferred transactions than adding the new
amount back in the bmap map transaction.  This means st_blocks on an
inode where all data is overwritten using the COW path can temporarily
show a 0 st_blocks.  This can easily be reproduced with the pending
zoned device support where all writes use this path and trips the
check in generic/615, but could also happen on a reflink file without
that.

Fix this by temporarily add the pending blocks to be mapped to
i_delayed_blks while the item is queued.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
fs/xfs/libxfs/xfs_bmap.c
fs/xfs/xfs_bmap_item.c