Btrfs: don't release invalid page in btrfs_page_exists_in_range()
authorFilipe Manana <fdmanana@gmail.com>
Thu, 5 Jun 2014 12:22:26 +0000 (13:22 +0100)
committerChris Mason <clm@fb.com>
Tue, 10 Jun 2014 00:21:14 +0000 (17:21 -0700)
In inode.c:btrfs_page_exists_in_range(), if the page we got from
the radix tree is an exception entry, which can't be retried, we
exit the loop with a non-NULL page and then call page_cache_release
against it, which is not ok since it's not a valid page. This could
also make us return true when we shouldn't.

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/inode.c

index f265f413acba39e59c99aac57b58998f98ab1d3c..477e64a1146ff82c35ac08e1bdcbec182e03d12a 100644 (file)
@@ -6776,6 +6776,7 @@ bool btrfs_page_exists_in_range(struct inode *inode, loff_t start, loff_t end)
                         * here as an exceptional entry: so return it without
                         * attempting to raise page count.
                         */
+                       page = NULL;
                        break; /* TODO: Is this relevant for this use case? */
                }