Skip to content

Commit

Permalink
Btrfs: make sure we retry if we couldn't get the page
Browse files Browse the repository at this point in the history
In inode.c:btrfs_page_exists_in_range(), if we can't get the page
we need to retry. However we weren't retrying because we weren't
setting page to NULL, which makes the while loop exit immediately
and will make us call page_cache_release after exiting the loop
which is incorrect because our page get didn't succeed. This could
also make us return true when we shouldn't.

Signed-off-by: Filipe David Borba Manana <[email protected]>
Signed-off-by: Chris Mason <[email protected]>
  • Loading branch information
fdmanana authored and masoncl committed Jun 10, 2014
1 parent c81d576 commit 9140515
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -6777,8 +6777,10 @@ bool btrfs_page_exists_in_range(struct inode *inode, loff_t start, loff_t end)
break; /* TODO: Is this relevant for this use case? */
}

if (!page_cache_get_speculative(page))
if (!page_cache_get_speculative(page)) {
page = NULL;
continue;
}

/*
* Has the page moved?
Expand Down

0 comments on commit 9140515

Please sign in to comment.