Re: [PATCH 01/25] libxfs: open-code "exit on buffer read failure" in upper level callers

Darrick J. Wong
2020-02-25T18:40:35Z

On Tue, Feb 25, 2020 at 09:42:52AM -0800, Christoph Hellwig wrote:
> On Mon, Feb 24, 2020 at 04:11:34PM -0800, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> >
> > Make all functions that use LIBXFS_EXIT_ON_FAILURE to abort on buffer
> > read errors implement that logic themselves. This also removes places
> > where libxfs can abort the program with no warning.
>
> How are the libxfs_mount changes related to this commit message?
>
> All the other bits looks fine, but those changes seem to have slipt in
> without a good reason.

Prior to this patch, the "!(flags & DEBUGGER)" expressions in the call
sites evaluate to 0 or 1, and this effectively results in libxfs_mount
passing EXIT_ON_FAILURE to the buffer read functions as the flag value.
The flag value is passed all the way down to __read_buf, and when it
sees an IO failure, it exits.

After this patch, libxfs_mount passes flags==0, which means that we get
a buffer back, possibly with b_error set. If b_error is set, we log a
warning about the screwed up filesystem and return a null mount if the
libxfs_mount caller didn't indicate that it is a debugger. Presumably
the libxfs_mount caller will exit with error if we return a null mount.

IOWs, I'm doing exactly what the commit message says, but in a rather
subtle way. I'll clarify that, if you'd like.

--D