All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Marzinski <bmarzins@redhat.com>
To: mwilck@suse.com
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>,
	dm-devel@lists.linux.dev
Subject: Re: [PATCH v2 03/14] libmultipath: directio: fix error handling
Date: Fri, 27 Oct 2023 14:54:53 -0400	[thread overview]
Message-ID: <ZTwHfWZfs2LNkEaZ@bmarzins-01.fast.rdu2.eng.redhat.com> (raw)
In-Reply-To: <20231026174153.1133-4-mwilck@suse.com>

On Thu, Oct 26, 2023 at 07:41:42PM +0200, mwilck@suse.com wrote:
> From: Martin Wilck <mwilck@suse.com>
> 
> libaio uses a different error return convention than glibc. The error code is
> not returned in errno, but as the negated return value of the function.
> Adapt the directio checker code.
> 
> Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
> ---
>  libmultipath/checkers/directio.c | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/libmultipath/checkers/directio.c b/libmultipath/checkers/directio.c
> index 83ab29f..12b8be4 100644
> --- a/libmultipath/checkers/directio.c
> +++ b/libmultipath/checkers/directio.c
> @@ -70,6 +70,7 @@ static struct aio_group *
>  add_aio_group(void)
>  {
>  	struct aio_group *aio_grp;
> +	int rc;
>  
>  	aio_grp = malloc(sizeof(struct aio_group));
>  	if (!aio_grp)
> @@ -77,9 +78,9 @@ add_aio_group(void)
>  	memset(aio_grp, 0, sizeof(struct aio_group));
>  	INIT_LIST_HEAD(&aio_grp->orphans);
>  
> -	if (io_setup(AIO_GROUP_SIZE, &aio_grp->ioctx) != 0) {
> +	if ((rc = io_setup(AIO_GROUP_SIZE, &aio_grp->ioctx)) != 0) {
>  		LOG(1, "io_setup failed");
> -		if (errno == EAGAIN)
> +		if (rc == -EAGAIN)
>  			LOG(1, "global number of io events too small. Increase fs.aio-max-nr with sysctl");
>  		free(aio_grp);
>  		return NULL;
> @@ -259,7 +260,6 @@ get_events(struct aio_group *aio_grp, struct timespec *timeout)
>  	struct timespec *timep = timeout;
>  
>  	do {
> -		errno = 0;
>  		nr = io_getevents(aio_grp->ioctx, 1, 128, events, timep);
>  		got_events |= (nr > 0);
>  
> @@ -283,8 +283,7 @@ get_events(struct aio_group *aio_grp, struct timespec *timeout)
>  	} while (nr == 128); /* assume there are more events and try again */
>  
>  	if (nr < 0)
> -		LOG(4, "async io getevents returned %i (errno=%s)",
> -		    nr, strerror(errno));
> +		LOG(4, "async io getevents returned %s", strerror(-nr));
>  
>  	return got_events;
>  }
> @@ -320,8 +319,8 @@ check_state(int fd, struct directio_context *ct, int sync, int timeout_secs)
>  		io_prep_pread(&ct->req->io, fd, ct->req->buf,
>  			      ct->req->blksize, 0);
>  		ct->req->state = PATH_PENDING;
> -		if (io_submit(ct->aio_grp->ioctx, 1, ios) != 1) {
> -			LOG(3, "io_submit error %i", errno);
> +		if ((rc = io_submit(ct->aio_grp->ioctx, 1, ios)) != 1) {
> +			LOG(3, "io_submit error %i", -rc);
>  			return PATH_UNCHECKED;
>  		}
>  	}
> -- 
> 2.42.0


  reply	other threads:[~2023-10-27 18:54 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-26 17:41 [PATCH v2 00/14] multipath: aio, systemd, and documentation improvements mwilck
2023-10-26 17:41 ` [PATCH v2 01/14] libmultipath: reduce log level of directio messages mwilck
2023-10-26 17:41 ` [PATCH v2 02/14] libmultipath: directio: don't reset ct->running after io_cancel() mwilck
2023-10-27 18:54   ` Benjamin Marzinski
2023-10-26 17:41 ` [PATCH v2 03/14] libmultipath: directio: fix error handling mwilck
2023-10-27 18:54   ` Benjamin Marzinski [this message]
2023-10-26 17:41 ` [PATCH v2 04/14] libmultipath: io_err_stat: don't free aio memory before completion mwilck
2023-10-27 18:55   ` Benjamin Marzinski
2023-10-26 17:41 ` [PATCH v2 05/14] libmultipath: io_err_stat: call io_destroy() inside free_io_err_pathvec() mwilck
2023-10-27 18:55   ` Benjamin Marzinski
2023-10-26 17:41 ` [PATCH v2 06/14] libmultipath: io_err_stat: use higher number of aio slots mwilck
2023-10-27 18:56   ` Benjamin Marzinski
2023-10-26 17:41 ` [PATCH v2 07/14] libmultipath: io_err_stat: fix error handling mwilck
2023-10-27 19:09   ` Benjamin Marzinski
2023-10-26 17:41 ` [PATCH v2 08/14] multipathd.service: require modprobe@dm_multipath.service if available mwilck
2023-10-27 19:09   ` Benjamin Marzinski
2023-10-27 20:05   ` Benjamin Marzinski
2023-10-30 11:45     ` Martin Wilck
2023-10-26 17:41 ` [PATCH v2 09/14] libmpathutil: remove systemd_service_enabled() mwilck
2023-10-26 17:41 ` [PATCH v2 10/14] multipath.conf.5: fix typo mwilck
2023-10-27 19:10   ` Benjamin Marzinski
2023-10-26 17:41 ` [PATCH v2 11/14] Makefile.inc, README.md: fix docs for prefix in split-usr case mwilck
2023-10-27 19:27   ` Benjamin Marzinski
2023-10-26 17:41 ` [PATCH v2 12/14] README.md: update mailing list and contributing information mwilck
2023-10-27 19:29   ` Benjamin Marzinski
2023-10-30 11:41     ` Martin Wilck
2023-10-26 17:41 ` [PATCH v2 13/14] README.md: Extend the section about NVMe mwilck
2023-10-27 19:34   ` Benjamin Marzinski
2023-10-26 17:41 ` [PATCH v2 14/14] README.md: fix formatting of Changelog section mwilck
2023-10-27 19:35   ` Benjamin Marzinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZTwHfWZfs2LNkEaZ@bmarzins-01.fast.rdu2.eng.redhat.com \
    --to=bmarzins@redhat.com \
    --cc=christophe.varoqui@opensvc.com \
    --cc=dm-devel@lists.linux.dev \
    --cc=mwilck@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.