[PATCH] xfstests: fix async io error handling in fsx

Christoph Hellwig hch at infradead.org
Mon Mar 30 12:54:51 CDT 2009


On Mon, Mar 30, 2009 at 12:30:50AM -0500, Felix Blyakher wrote:
> --- a/ltp/fsx.c
> +++ b/ltp/fsx.c
> @@ -976,19 +976,41 @@ __aio_rw(int rw, int fd, char *buf, unsigned len, unsigned offset)
>  		fprintf(stderr, "errcode=%d\n", ret);
>  		fprintf(stderr, "aio_rw: io_submit failed: %s\n",
>  				strerror(ret));
> -		return(-1);
> +		errno = -ret;
> +		return -1;

I think we'd be better off having all these places that set errno in one
place and use goto labels.  That way you can also add a small comment
about it.

> +		/*
> +		 * The b0rked libaio defines event.res as signed.
> +		 * However the kernel strucuture has it unsigned,
> +		 * and it's used to pass negated error value.
> +		 * Till the library is fixed use the temp var.
> +		 */

This comment seems backwards to the patch description and the actual
code.




More information about the xfs mailing list