mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-20 05:31:15 +00:00
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>
This commit is contained in:
parent
a0e336ba3e
commit
2ba090d521
3 changed files with 21 additions and 6 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue