diff options
Diffstat (limited to 'fs/xfs/xfs_reflink.c')
-rw-r--r-- | fs/xfs/xfs_reflink.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c index 3246815c24d6..37e603bf1591 100644 --- a/fs/xfs/xfs_reflink.c +++ b/fs/xfs/xfs_reflink.c | |||
@@ -736,7 +736,13 @@ xfs_reflink_end_cow( | |||
736 | /* If there is a hole at end_fsb - 1 go to the previous extent */ | 736 | /* If there is a hole at end_fsb - 1 go to the previous extent */ |
737 | if (!xfs_iext_lookup_extent(ip, ifp, end_fsb - 1, &idx, &got) || | 737 | if (!xfs_iext_lookup_extent(ip, ifp, end_fsb - 1, &idx, &got) || |
738 | got.br_startoff > end_fsb) { | 738 | got.br_startoff > end_fsb) { |
739 | ASSERT(idx > 0); | 739 | /* |
740 | * In case of racing, overlapping AIO writes no COW extents | ||
741 | * might be left by the time I/O completes for the loser of | ||
742 | * the race. In that case we are done. | ||
743 | */ | ||
744 | if (idx <= 0) | ||
745 | goto out_cancel; | ||
740 | xfs_iext_get_extent(ifp, --idx, &got); | 746 | xfs_iext_get_extent(ifp, --idx, &got); |
741 | } | 747 | } |
742 | 748 | ||
@@ -809,6 +815,7 @@ next_extent: | |||
809 | 815 | ||
810 | out_defer: | 816 | out_defer: |
811 | xfs_defer_cancel(&dfops); | 817 | xfs_defer_cancel(&dfops); |
818 | out_cancel: | ||
812 | xfs_trans_cancel(tp); | 819 | xfs_trans_cancel(tp); |
813 | xfs_iunlock(ip, XFS_ILOCK_EXCL); | 820 | xfs_iunlock(ip, XFS_ILOCK_EXCL); |
814 | out: | 821 | out: |