* [PATCH] fsr: preserve xfrog_bulkstat error codes
@ 2026-06-24 8:11 liuh
2026-06-24 8:14 ` Christoph Hellwig
2026-06-24 17:20 ` Darrick J. Wong
0 siblings, 2 replies; 3+ messages in thread
From: liuh @ 2026-06-24 8:11 UTC (permalink / raw)
To: djwong, hch; +Cc: linux-xfs, liuh
Fix the bulkstat loop condition in fsrfs() to assign the return
value of xfrog_bulkstat() to ret before comparing it against zero.
Without the extra parentheses, operator precedence causes ret
to receive only the result of the comparison (0 or 1), which
discards the actual error code and breaks error reporting.
Signed-off-by: liuh <liuhuan01@kylinos.cn>
---
fsr/xfs_fsr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fsr/xfs_fsr.c b/fsr/xfs_fsr.c
index e74180c1..68cc0ea4 100644
--- a/fsr/xfs_fsr.c
+++ b/fsr/xfs_fsr.c
@@ -678,7 +678,7 @@ fsrfs(char *mntdir, xfs_ino_t startino, int targetrange)
return -1;
}
- while ((ret = -xfrog_bulkstat(&fsxfd, breq) == 0)) {
+ while ((ret = -xfrog_bulkstat(&fsxfd, breq)) == 0) {
struct xfs_bulkstat *buf = breq->bulkstat;
struct xfs_bulkstat *p;
struct xfs_bulkstat *endp;
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] fsr: preserve xfrog_bulkstat error codes
2026-06-24 8:11 [PATCH] fsr: preserve xfrog_bulkstat error codes liuh
@ 2026-06-24 8:14 ` Christoph Hellwig
2026-06-24 17:20 ` Darrick J. Wong
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2026-06-24 8:14 UTC (permalink / raw)
To: liuh; +Cc: djwong, hch, linux-xfs
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] fsr: preserve xfrog_bulkstat error codes
2026-06-24 8:11 [PATCH] fsr: preserve xfrog_bulkstat error codes liuh
2026-06-24 8:14 ` Christoph Hellwig
@ 2026-06-24 17:20 ` Darrick J. Wong
1 sibling, 0 replies; 3+ messages in thread
From: Darrick J. Wong @ 2026-06-24 17:20 UTC (permalink / raw)
To: liuh; +Cc: hch, linux-xfs
On Wed, Jun 24, 2026 at 04:11:35PM +0800, liuh wrote:
> Fix the bulkstat loop condition in fsrfs() to assign the return
> value of xfrog_bulkstat() to ret before comparing it against zero.
>
> Without the extra parentheses, operator precedence causes ret
> to receive only the result of the comparison (0 or 1), which
> discards the actual error code and breaks error reporting.
>
> Signed-off-by: liuh <liuhuan01@kylinos.cn>
> ---
> fsr/xfs_fsr.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fsr/xfs_fsr.c b/fsr/xfs_fsr.c
> index e74180c1..68cc0ea4 100644
> --- a/fsr/xfs_fsr.c
> +++ b/fsr/xfs_fsr.c
> @@ -678,7 +678,7 @@ fsrfs(char *mntdir, xfs_ino_t startino, int targetrange)
> return -1;
> }
>
> - while ((ret = -xfrog_bulkstat(&fsxfd, breq) == 0)) {
> + while ((ret = -xfrog_bulkstat(&fsxfd, breq)) == 0) {
Heh, oops.
Cc: <linux-xfs@vger.kernel.org> # v5.3.0
Fixes: e6542132dec3cd ("libfrog: convert bulkstat.c functions to negative error codes")
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
--D
> struct xfs_bulkstat *buf = breq->bulkstat;
> struct xfs_bulkstat *p;
> struct xfs_bulkstat *endp;
> --
> 2.43.0
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-06-24 17:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-24 8:11 [PATCH] fsr: preserve xfrog_bulkstat error codes liuh
2026-06-24 8:14 ` Christoph Hellwig
2026-06-24 17:20 ` Darrick J. Wong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox