mbox series

[v2,00/14] xfsprogs: make buffer functions return error codes

Message ID 158258964941.453666.10913737544282124969.stgit@magnolia (mailing list archive)
Headers show
Series xfsprogs: make buffer functions return error codes | expand

Message

Darrick J. Wong Feb. 25, 2020, 12:14 a.m. UTC
Hi all,

Let's fix all the xfs read/get buffer functions to return the usual
integer error codes and pass the buffer pointer as a out-argument.  This
makes it so that we can return useful error output instead of making
callers infer ENOMEM or EAGAIN or whatever other reality they crave from
the NULL pointer that they get when things don't go perfectly.

FWIW, all XBF_TRYLOCK callers must now trigger retries if they receive
EAGAIN.  This may lead to a slight behavioral change in that TRYLOCK
callers will no longer retry for things like ENOMEM, though I didn't see
any obvious changes in user-visible behavior when running fstests.

After finishing the error code conversion, we straighten out the TRYLOCK
callers to remove all this null pointer checks in favor of explicit
EAGAIN checks; and then we change the buffer IO/corruption error
reporting so that we report whoever called the buffer code even when
reading a buffer in transaction context.

The userspace port of the kernel patchset was very difficult, so I am
submitting this series to avoid dumping the work on Eric.  Note also
that this series applies after the first part of the 5.6 libxfs port.
For v2, the "read and salvage" flag only applies to corruption, so
callers must handle EIO separately.

If you're going to start using this mess, you probably ought to just
pull from my git trees, which are linked below.

This is an extraordinary way to destroy everything.  Enjoy!
Comments and questions are, as always, welcome.

--D

xfsprogs git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=buf-return-errorcodes