diff options
author | Christoph Hellwig <hch@lst.de> | 2018-08-07 19:57:12 +0200 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2018-08-07 19:57:12 +0200 |
commit | 2ba090d521c5e09f32316c179d25bb6f699d3568 (patch) | |
tree | 1171512eca076f1e10fea00dcf8e07766486c1a4 /fs/xfs/xfs_aops.c | |
parent | xfs: fix a comment in xfs_log_reserve (diff) | |
download | linux-2ba090d521c5e09f32316c179d25bb6f699d3568.tar.xz linux-2ba090d521c5e09f32316c179d25bb6f699d3568.zip |
xfs: use WRITE_ONCE to update if_seq
This adds ordering of the updates and makes sure we always see the if_seq
update before the extent tree is modified.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs/xfs_aops.c')
-rw-r--r-- | fs/xfs/xfs_aops.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c index 235b4ddcd324..49f5f5896a43 100644 --- a/fs/xfs/xfs_aops.c +++ b/fs/xfs/xfs_aops.c @@ -351,7 +351,7 @@ xfs_map_blocks( if (imap_valid && (!xfs_inode_has_cow_data(ip) || wpc->io_type == XFS_IO_COW || - wpc->cow_seq == ip->i_cowfp->if_seq)) + wpc->cow_seq == READ_ONCE(ip->i_cowfp->if_seq))) return 0; if (XFS_FORCED_SHUTDOWN(mp)) @@ -380,7 +380,7 @@ xfs_map_blocks( xfs_iext_lookup_extent(ip, ip->i_cowfp, offset_fsb, &icur, &imap)) cow_fsb = imap.br_startoff; if (cow_fsb != NULLFILEOFF && cow_fsb <= offset_fsb) { - wpc->cow_seq = ip->i_cowfp->if_seq; + wpc->cow_seq = READ_ONCE(ip->i_cowfp->if_seq); xfs_iunlock(ip, XFS_ILOCK_SHARED); /* * Truncate can race with writeback since writeback doesn't |