Update misleading debug messages for directio checker
authorHannes Reinecke <hare@suse.de>
Wed, 21 Jan 2009 12:26:51 +0000 (13:26 +0100)
committerChristophe Varoqui <christophe.varoqui@free.fr>
Tue, 21 Apr 2009 23:22:52 +0000 (01:22 +0200)
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>
libmultipath/checkers/directio.c

index 5c92dac..4728424 100644 (file)
@@ -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;