File multipath-tools-fix-directio-error-messages of Package multipath-tools

commit 91b2c44cb23076ec0cb647dc42b438f1583677c7
Author: Hannes Reinecke <hare@suse.de>
Date:   Wed Jan 21 13:26:51 2009 +0100

    Update misleading debug messages for directio checker
    
    io_getevents returns the number of events received, so '1'
    is actual a success. And calling 'strerror(errno)' unconditionally
    here will lead to false errors as the errno value won't be
    updated then.
    
    Signed-off-by: Hannes Reinecke <hare@suse.de>

diff --git a/libmultipath/checkers/directio.c b/libmultipath/checkers/directio.c
index c701609..ecf0dd2 100644
--- a/libmultipath/checkers/directio.c
+++ b/libmultipath/checkers/directio.c
@@ -149,14 +149,19 @@ check_state(int fd, struct directio_context *ct, int sync)
 	ct->running++;
 
 	r = io_getevents(ct->ioctx, 1L, 1L, &event, &timeout);
-	LOG(3, "async io getevents returns %li (errno=%s)", r, strerror(errno));
 
-	if (r < 1L) {
+	if (r < 0 ) {
+		LOG(3, "async io getevents returned %li (errno=%s)", r,
+		    strerror(errno));
+		rc = PATH_UNCHECKED;
+	} else if (r < 1L) {
 		if (ct->running > ASYNC_TIMEOUT_SEC || sync) {
 			LOG(3, "abort check on timeout");
 			rc = PATH_DOWN;
-		} else
+		} else {
+			LOG(3, "async io pending");
 			rc = PATH_PENDING;
+		}
 	} else {
 		LOG(3, "io finished %lu/%lu", event.res, event.res2);
 		ct->running = 0;
openSUSE Build Service is sponsored by