From: Benjamin Marzinski <bmarzins@redhat.com>
To: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: device-mapper development <dm-devel@redhat.com>,
Martin Wilck <Martin.Wilck@suse.com>
Subject: [PATCH v2 4/5] libmultipath: change directio get_events() timeout handling
Date: Wed, 19 Feb 2020 14:21:44 -0600 [thread overview]
Message-ID: <1582143705-20886-5-git-send-email-bmarzins@redhat.com> (raw)
In-Reply-To: <1582143705-20886-1-git-send-email-bmarzins@redhat.com>
get_events() used a NULL or a zeroed timeout to mean "don't wait".
io_getevents() uses a NULL timeout to mean "wait forever" and a
zeroed timeout to mean "don't wait". Make get_events() work like
io_getevents().
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/checkers/directio.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/libmultipath/checkers/directio.c b/libmultipath/checkers/directio.c
index 6ad7c885..649961a4 100644
--- a/libmultipath/checkers/directio.c
+++ b/libmultipath/checkers/directio.c
@@ -262,7 +262,7 @@ get_events(struct aio_group *aio_grp, struct timespec *timeout)
struct io_event events[128];
int i, nr, got_events = 0;
struct timespec zero_timeout = {0};
- struct timespec *timep = (timeout)? timeout : &zero_timeout;
+ struct timespec *timep = timeout;
do {
errno = 0;
@@ -303,7 +303,6 @@ check_state(int fd, struct directio_context *ct, int sync, int timeout_secs)
int rc;
long r;
struct timespec currtime, endtime;
- struct timespec *timep = &timeout;
if (fstat(fd, &sb) == 0) {
LOG(4, "called for %x", (unsigned) sb.st_rdev);
@@ -339,18 +338,19 @@ check_state(int fd, struct directio_context *ct, int sync, int timeout_secs)
endtime.tv_nsec += timeout.tv_nsec;
normalize_timespec(&endtime);
while(1) {
- r = get_events(ct->aio_grp, timep);
+ r = get_events(ct->aio_grp, &timeout);
if (ct->req->state != PATH_PENDING) {
ct->running = 0;
return ct->req->state;
- } else if (r == 0 || !timep)
+ } else if (r == 0 ||
+ (timeout.tv_sec == 0 && timeout.tv_nsec == 0))
break;
get_monotonic_time(&currtime);
timespecsub(&endtime, &currtime, &timeout);
if (timeout.tv_sec < 0)
- timep = NULL;
+ timeout.tv_sec = timeout.tv_nsec = 0;
}
if (ct->running > timeout_secs || sync) {
struct io_event event;
--
2.17.2
next prev parent reply other threads:[~2020-02-19 20:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-19 20:21 [PATCH v2 0/5] Multipath Follow-up patches Benjamin Marzinski
2020-02-19 20:21 ` [PATCH v2 1/5] multipath: fix issues found by compiling with gcc 10 Benjamin Marzinski
2020-02-19 20:39 ` Martin Wilck
2020-12-02 13:54 ` [dm-devel] " Martin Wilck
2020-12-03 20:52 ` Benjamin Marzinski
2020-02-19 20:21 ` [PATCH v2 2/5] libmultipath: turn pp->vpd_data into a pointer Benjamin Marzinski
2020-02-19 20:21 ` [PATCH v2 3/5] libmultipath: change loading and resetting in directio Benjamin Marzinski
2020-02-19 20:21 ` Benjamin Marzinski [this message]
2020-02-19 20:21 ` [PATCH v2 5/5] libmultipath: cleanup old issues with directio checker 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=1582143705-20886-5-git-send-email-bmarzins@redhat.com \
--to=bmarzins@redhat.com \
--cc=Martin.Wilck@suse.com \
--cc=christophe.varoqui@opensvc.com \
--cc=dm-devel@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).