summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2017-12-10 18:03:55 -0800
committerDarrick J. Wong <darrick.wong@oracle.com>2017-12-14 09:20:11 -0800
commit73353f486c9b5b2407ec32be1004174dbbaf6c18 (patch)
tree3615f389875a3556667d4dd35619f84770d7e69e
parent5c989a0ee06eb77a44baffd1779a5dbb9a7e873f (diff)
downloadlinux-73353f486c9b5b2407ec32be1004174dbbaf6c18.tar.gz
linux-73353f486c9b5b2407ec32be1004174dbbaf6c18.tar.bz2
linux-73353f486c9b5b2407ec32be1004174dbbaf6c18.zip
xfs: relax is_reflink_inode assert in xfs_reflink_find_cow_mapping
We don't hold the ilock through the entire sequence of xfs_writepage_map -> xfs_map_cow -> xfs_reflink_find_cow_mapping. This means that we can race with another thread that is trying to clear the inode reflink flag, with the result that the flag is set for the xfs_map_cow check but cleared before we get to the assert in find_cow_mapping. When this happens, we blow the assert even though everything is fine. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
-rw-r--r--fs/xfs/xfs_reflink.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
index e13f5ad57a03..99c5852f9fe7 100644
--- a/fs/xfs/xfs_reflink.c
+++ b/fs/xfs/xfs_reflink.c
@@ -490,8 +490,9 @@ xfs_reflink_find_cow_mapping(
struct xfs_iext_cursor icur;
ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL | XFS_ILOCK_SHARED));
- ASSERT(xfs_is_reflink_inode(ip));
+ if (!xfs_is_reflink_inode(ip))
+ return false;
offset_fsb = XFS_B_TO_FSBT(ip->i_mount, offset);
if (!xfs_iext_lookup_extent(ip, ifp, offset_fsb, &icur, &got))
return false;