]> git.apps.os.sepia.ceph.com Git - xfsprogs-dev.git/commit
xfs: use iomap_valid method to detect stale cached iomaps
authorDave Chinner <dchinner@redhat.com>
Wed, 15 Mar 2023 14:47:39 +0000 (15:47 +0100)
committerCarlos Maiolino <cem@kernel.org>
Fri, 17 Mar 2023 10:38:46 +0000 (11:38 +0100)
commit1dcdf5051790867e4631dfaa5fc02e1d9e957fee
treef56196754b856452022e2daef954daed5761fe45
parent9a046f967f9f312acec6963947e98f9e69d4b58c
xfs: use iomap_valid method to detect stale cached iomaps

Source kernel commit: 304a68b9c63bbfc1f6e159d68e8892fc54a06067

Now that iomap supports a mechanism to validate cached iomaps for
buffered write operations, hook it up to the XFS buffered write ops
so that we can avoid data corruptions that result from stale cached
iomaps. See:

https://lore.kernel.org/linux-xfs/20220817093627.GZ3600936@dread.disaster.area/

or the ->iomap_valid() introduction commit for exact details of the
corruption vector.

The validity cookie we store in the iomap is based on the type of
iomap we return. It is expected that the iomap->flags we set in
xfs_bmbt_to_iomap() is not perturbed by the iomap core and are
returned to us in the iomap passed via the .iomap_valid() callback.
This ensures that the validity cookie is always checking the correct
inode fork sequence numbers to detect potential changes that affect
the extent cached by the iomap.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
libxfs/libxfs_priv.h
libxfs/xfs_bmap.c