]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: simple btree query range should look right if LE lookup fails
authorDarrick J. Wong <darrick.wong@oracle.com>
Fri, 26 Aug 2016 01:17:21 +0000 (11:17 +1000)
committerDave Chinner <david@fromorbit.com>
Fri, 26 Aug 2016 01:17:21 +0000 (11:17 +1000)
If the initial LOOKUP_LE in the simple query range fails to find
anything, we should attempt to increment the btree cursor to see
if there actually /are/ records for what we're trying to find.
Without this patch, a bnobt range query of (0, $agsize) returns
no results because the leftmost record never has a startblock
of zero.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
libxfs/xfs_btree.c

index b69c8d2f48b2667fc6704f7d5dd3dd9d58af660f..8e928ea131d6725827f738917d43e6beee86849a 100644 (file)
@@ -4558,6 +4558,13 @@ xfs_btree_simple_query_range(
        if (error)
                goto out;
 
+       /* Nothing?  See if there's anything to the right. */
+       if (!stat) {
+               error = xfs_btree_increment(cur, 0, &stat);
+               if (error)
+                       goto out;
+       }
+
        while (stat) {
                /* Find the record. */
                error = xfs_btree_get_rec(cur, &recp, &stat);