Thread (5 messages) 5 messages, 2 authors, 2018-02-22

Re: [PATCH] libxfs: don't return cnt as failure from XFS_BUF_SET_PTR

From: Eric Sandeen <hidden>
Date: 2018-02-22 22:41:18

On 2/22/18 3:46 PM, Darrick J. Wong wrote:
On Thu, Feb 22, 2018 at 03:33:04PM -0600, Eric Sandeen wrote:
quoted
We must not get here very often, because any test of an error
from XFS_BUF_SET_PTR will fail because it  returns whatever
is sent in as cnt.  Fix the macro to return 0 so that
"error = XFS_BUF_SET_PTR()" works as expected.

Should probably make this xfs_buf_associate_memory() to be
more like kernelspace, but for now just fix up the bug.

Found this via xfs_logprint failing for no good reason.

Signed-off-by: Eric Sandeen <redacted>
---
diff --git a/libxfs/libxfs_io.h b/libxfs/libxfs_io.h
index 81d2804..0ae7a28 100644
--- a/libxfs/libxfs_io.h
+++ b/libxfs/libxfs_io.h
@@ -105,6 +105,7 @@ enum xfs_buf_flags_t {	/* b_flags bits */
 #define XFS_BUF_SET_PTR(bp,p,cnt)	({	\
 	(bp)->b_addr = (char *)(p);		\
 	XFS_BUF_SET_COUNT(bp,cnt);		\
+	0;					\
There are only two callers of this macro and it's not exported to
xfslibs headers, so why not just fix them not to care about the return
value?
because it marginally matches kernel code ... *shrug* I'd rather
have libxlog diverge less from kernel, not more, overall.

-Eric
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help