summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_reflink.c
diff options
context:
space:
mode:
authorAlex Shi <alex.shi@linaro.org>2017-10-28 04:06:55 (GMT)
committerAlex Shi <alex.shi@linaro.org>2017-10-28 04:06:55 (GMT)
commit2350bc148253bbd1a6c2c1ca062a6405c40ed0db (patch)
tree83e7f4cc5557fbb6e00e359113056fa136c52153 /fs/xfs/xfs_reflink.c
parent7b2f683fe2733153307cc6b870bcb37c87331cc9 (diff)
parentd785062ef20f9b2cd8cedcafea55ca8264f25f3e (diff)
downloadlinux-2350bc148253bbd1a6c2c1ca062a6405c40ed0db.tar.xz
Merge tag 'v4.9.59' into linux-linaro-lsk-v4.9
This is the 4.9.59 stable release
Diffstat (limited to 'fs/xfs/xfs_reflink.c')
-rw-r--r--fs/xfs/xfs_reflink.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
index 0015c19..17d3c96 100644
--- a/fs/xfs/xfs_reflink.c
+++ b/fs/xfs/xfs_reflink.c
@@ -767,7 +767,13 @@ xfs_reflink_end_cow(
/* If there is a hole at end_fsb - 1 go to the previous extent */
if (eof || got.br_startoff > end_fsb) {
- ASSERT(idx > 0);
+ /*
+ * In case of racing, overlapping AIO writes no COW extents
+ * might be left by the time I/O completes for the loser of
+ * the race. In that case we are done.
+ */
+ if (idx <= 0)
+ goto out_cancel;
xfs_bmbt_get_all(xfs_iext_get_ext(ifp, --idx), &got);
}
@@ -841,6 +847,7 @@ next_extent:
out_defer:
xfs_defer_cancel(&dfops);
+out_cancel:
xfs_trans_cancel(tp);
xfs_iunlock(ip, XFS_ILOCK_EXCL);
out: