libiscsi: continue working when meets EINTR or EAGAIN
[fio.git] / engines / libiscsi.c
index e4eb0bab9297f6977b9e7b14b823aef3859e643f..58667fb216102f21bf7ee4bfaedbb2a1799c929a 100644 (file)
@@ -117,7 +117,8 @@ static int fio_iscsi_setup_lun(struct iscsi_info *iscsi_info,
 
        task = iscsi_readcapacity16_sync(iscsi_lun->iscsi, iscsi_lun->url->lun);
        if (task == NULL || task->status != SCSI_STATUS_GOOD) {
-               log_err("iscsi: failed to send readcapacity command\n");
+               log_err("iscsi: failed to send readcapacity command: %s\n",
+                       iscsi_get_error(iscsi_lun->iscsi));
                ret = EINVAL;
                goto out;
        }
@@ -350,6 +351,9 @@ static int fio_iscsi_getevents(struct thread_data *td, unsigned int min,
 
                ret = poll(iscsi_info->pfds, iscsi_info->nr_luns, -1);
                if (ret < 0) {
+                       if (errno == EINTR || errno == EAGAIN) {
+                               continue;
+                       }
                        log_err("iscsi: failed to poll events: %s.\n",
                                strerror(errno));
                        break;