Unverified Commit 73321102 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!6015 btrfs: don't drop extent_map for free space inode on write error

parents ea53fb98 c671f65e
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
@@ -3145,7 +3145,21 @@ static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent)
		end = ordered_extent->file_offset + ordered_extent->len - 1;
		clear_extent_uptodate(io_tree, start, end, NULL);

		/* Drop the cache for the part of the extent we didn't write. */
		/*
		 * Drop extent maps for the part of the extent we didn't write.
		 *
		 * We have an exception here for the free_space_inode, this is
		 * because when we do btrfs_get_extent() on the free space inode
		 * we will search the commit root.  If this is a new block group
		 * we won't find anything, and we will trip over the assert in
		 * writepage where we do ASSERT(em->block_start !=
		 * EXTENT_MAP_HOLE).
		 *
		 * Theoretically we could also skip this for any NOCOW extent as
		 * we don't mess with the extent map tree in the NOCOW case, but
		 * for now simply skip this if we are the free space inode.
		 */
		if (!btrfs_is_free_space_inode(BTRFS_I(inode)))
			btrfs_drop_extent_cache(BTRFS_I(inode), start, end, 0);

		/*