diff mbox series

[3/4] xfs: don't return _QUERY_ABORT from xfs_rmap_has_other_keys

Message ID 156685614244.2853532.3739810624053899109.stgit@magnolia (mailing list archive)
State Accepted
Headers show
Series xfs: fixes for 5.4 | expand

Commit Message

Darrick J. Wong Aug. 26, 2019, 9:49 p.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

The xfs_rmap_has_other_keys helper aborts the iteration as soon as it
has an answer.  Don't let this abort leak out to callers.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 fs/xfs/libxfs/xfs_rmap.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Dave Chinner Aug. 26, 2019, 11:15 p.m. UTC | #1
On Mon, Aug 26, 2019 at 02:49:02PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> The xfs_rmap_has_other_keys helper aborts the iteration as soon as it
> has an answer.  Don't let this abort leak out to callers.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  fs/xfs/libxfs/xfs_rmap.c |    5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> 
> diff --git a/fs/xfs/libxfs/xfs_rmap.c b/fs/xfs/libxfs/xfs_rmap.c
> index e6aeb390b2fb..819693ef852c 100644
> --- a/fs/xfs/libxfs/xfs_rmap.c
> +++ b/fs/xfs/libxfs/xfs_rmap.c
> @@ -2540,8 +2540,11 @@ xfs_rmap_has_other_keys(
>  
>  	error = xfs_rmap_query_range(cur, &low, &high,
>  			xfs_rmap_has_other_keys_helper, &rks);
> +	if (error < 0)
> +		return error;
> +
>  	*has_rmap = rks.has_rmap;
> -	return error;
> +	return 0;
>  }

Yup, makes sense - XFS_BTREE_QUERY_RANGE_ABORT has a positive value,
so this makes success have a return value of 0 and that fixes
the spurious error detection in xrep_reap_block().

Reviewed-by: Dave Chinner <dchinner@redhat.com>
diff mbox series

Patch

diff --git a/fs/xfs/libxfs/xfs_rmap.c b/fs/xfs/libxfs/xfs_rmap.c
index e6aeb390b2fb..819693ef852c 100644
--- a/fs/xfs/libxfs/xfs_rmap.c
+++ b/fs/xfs/libxfs/xfs_rmap.c
@@ -2540,8 +2540,11 @@  xfs_rmap_has_other_keys(
 
 	error = xfs_rmap_query_range(cur, &low, &high,
 			xfs_rmap_has_other_keys_helper, &rks);
+	if (error < 0)
+		return error;
+
 	*has_rmap = rks.has_rmap;
-	return error;
+	return 0;
 }
 
 const struct xfs_owner_info XFS_RMAP_OINFO_SKIP_UPDATE = {