summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2022-11-09 09:51:36 -0800
committerDarrick J. Wong <djwong@kernel.org>2022-11-09 10:11:18 -0800
commit1b6fed78a892532e5aecd0b476fdeacb13c255b0 (patch)
treed0cb356c55f27db265f333d1e61df8f118286317
parentcc6673647c80c0d54446c570568ba693fa275c1c (diff)
xfs: validate COW fork sequence counters during buffered writes
In the previous patch, we transformed the iomap revalidation code to use an explicit context object where data and cow fork sequence counters are tracked explicitly. The existing validation function only validated the data fork sequence counter, so now let's make it validate both. I /think/ this isn't actually necessary here because we're writing to the page cache, and the page state does not track or care about cow status. However, this question came up when Dave and I were chatting about this patchset on IRC, so here it is for formal consideration. Signed-off-by: Darrick J. Wong <djwong@kernel.org>
-rw-r--r--fs/xfs/xfs_iomap.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index c3c23524a3d2..5e746df2c63f 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -1370,6 +1370,9 @@ xfs_buffered_write_iomap_valid(
if (ibc->data_seq != READ_ONCE(ip->i_df.if_seq))
return false;
+ if (ibc->has_cow_seq &&
+ ibc->cow_seq != READ_ONCE(ip->i_cowfp->if_seq))
+ return false;
return true;
}