From d13e424301d16efb632f80953f7f7ce1e8f6eac4 Mon Sep 17 00:00:00 2001 From: Hannes Reinecke Date: Tue, 3 May 2011 09:07:52 +0200 Subject: [PATCH] Use timeout parameter for directio As checkers now have a timeout we should be using this one for directio, too. Signed-off-by: Hannes Reinecke --- 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 6696b41..b517039 100644 --- a/libmultipath/checkers/directio.c +++ b/libmultipath/checkers/directio.c @@ -117,7 +117,7 @@ void libcheck_free (struct checker * c) } static int -check_state(int fd, struct directio_context *ct, int sync) +check_state(int fd, struct directio_context *ct, int sync, int timeout_secs) { struct timespec timeout = { .tv_nsec = 5 }; struct io_event event; @@ -128,9 +128,9 @@ check_state(int fd, struct directio_context *ct, int sync) if (fstat(fd, &sb) == 0) { LOG(4, "called for %x", (unsigned) sb.st_rdev); } - if (sync) { + if (sync > 0) { LOG(4, "called in synchronous mode"); - timeout.tv_sec = ASYNC_TIMEOUT_SEC; + timeout.tv_sec = timeout_secs; timeout.tv_nsec = 0; } @@ -155,7 +155,7 @@ check_state(int fd, struct directio_context *ct, int sync) strerror(errno)); rc = PATH_UNCHECKED; } else if (r < 1L) { - if (ct->running > ASYNC_TIMEOUT_SEC || sync) { + if (ct->running > timeout_secs || sync) { LOG(3, "abort check on timeout"); rc = PATH_DOWN; } else { @@ -179,7 +179,7 @@ int libcheck_check (struct checker * c) if (!ct) return PATH_UNCHECKED; - ret = check_state(c->fd, ct, c->sync); + ret = check_state(c->fd, ct, c->sync, c->timeout); switch (ret) { -- 2.7.4