Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 55ef6899 authored by Yan, Zheng's avatar Yan, Zheng Committed by Chris Mason
Browse files

Btrfs: Fix btrfs_drop_extent_cache for skip pinned case



The check for skip pinned case is wrong, it may breaks the
while loop too soon.

Signed-off-by: default avatarYan Zheng <zheng.yan@oracle.com>
Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent 24bbcf04
Loading
Loading
Loading
Loading
+3 −7
Original line number Diff line number Diff line
@@ -179,18 +179,14 @@ int btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end,
		}
		flags = em->flags;
		if (skip_pinned && test_bit(EXTENT_FLAG_PINNED, &em->flags)) {
			if (em->start <= start &&
			    (!testend || em->start + em->len >= start + len)) {
			if (testend && em->start + em->len >= start + len) {
				free_extent_map(em);
				write_unlock(&em_tree->lock);
				break;
			}
			if (start < em->start) {
				len = em->start - start;
			} else {
				len = start + len - (em->start + em->len);
			start = em->start + em->len;
			}
			if (testend)
				len = start + len - (em->start + em->len);
			free_extent_map(em);
			write_unlock(&em_tree->lock);
			continue;