diff options
Diffstat (limited to 'fs/xfs/xfs_bmap.c')
-rw-r--r-- | fs/xfs/xfs_bmap.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c index c21e01a9b2dd..cf4dee01983a 100644 --- a/fs/xfs/xfs_bmap.c +++ b/fs/xfs/xfs_bmap.c | |||
@@ -1746,11 +1746,18 @@ xfs_bmap_add_extent_unwritten_real( | |||
1746 | if ((error = xfs_bmbt_insert(cur, &i))) | 1746 | if ((error = xfs_bmbt_insert(cur, &i))) |
1747 | goto done; | 1747 | goto done; |
1748 | XFS_WANT_CORRUPTED_GOTO(i == 1, done); | 1748 | XFS_WANT_CORRUPTED_GOTO(i == 1, done); |
1749 | if ((error = xfs_bmbt_increment(cur, 0, &i))) | 1749 | /* |
1750 | * Reset the cursor to the position of the new extent | ||
1751 | * we are about to insert as we can't trust it after | ||
1752 | * the previous insert. | ||
1753 | */ | ||
1754 | if ((error = xfs_bmbt_lookup_eq(cur, new->br_startoff, | ||
1755 | new->br_startblock, new->br_blockcount, | ||
1756 | &i))) | ||
1750 | goto done; | 1757 | goto done; |
1751 | XFS_WANT_CORRUPTED_GOTO(i == 1, done); | 1758 | XFS_WANT_CORRUPTED_GOTO(i == 0, done); |
1752 | /* new middle extent - newext */ | 1759 | /* new middle extent - newext */ |
1753 | cur->bc_rec.b = *new; | 1760 | cur->bc_rec.b.br_state = new->br_state; |
1754 | if ((error = xfs_bmbt_insert(cur, &i))) | 1761 | if ((error = xfs_bmbt_insert(cur, &i))) |
1755 | goto done; | 1762 | goto done; |
1756 | XFS_WANT_CORRUPTED_GOTO(i == 1, done); | 1763 | XFS_WANT_CORRUPTED_GOTO(i == 1, done); |