xfs: use iomap_valid method to detect stale cached iomaps
mainline inclusion from mainline-v6.1-rc4 commit 304a68b9 category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I76JSK CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=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> conflicts: fs/xfs/libxfs/xfs_bmap.c fs/xfs/xfs_aops.c fs/xfs/xfs_iomap.c fs/xfs/xfs_iomap.h fs/xfs/xfs_pnfs.c Signed-off-by:
Ye Bin <yebini10@huawei.com> Signed-off-by:
Long Li <leo.lilong@huawei.com>
Loading
Please sign in to comment