You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
156 lines
4.8 KiB
156 lines
4.8 KiB
diff --git a/configure.ac b/configure.ac |
|
index cf62b64..4001400 100644 |
|
--- a/configure.ac |
|
+++ b/configure.ac |
|
@@ -29,6 +29,7 @@ AC_ARG_ENABLE([werror], [AS_HELP_STRING([--disable-werror], |
|
|
|
if test "$ac_cv_prog_gcc" = yes; then |
|
WARN_CFLAGS="-Wall -W -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-align -Wno-strict-aliasing" |
|
+ WARN_CFLAGS="$WARN_CFLAGS -Wno-unknown-warning-option -Wno-stringop-truncation" |
|
if test "x$enable_werror" != "xno"; then |
|
WARN_CFLAGS="$WARN_CFLAGS -Werror" |
|
fi |
|
diff --git a/lib/iser.c b/lib/iser.c |
|
index 898d6b5..d140ad6 100644 |
|
--- a/lib/iser.c |
|
+++ b/lib/iser.c |
|
@@ -964,7 +964,7 @@ iser_post_recvm(struct iser_conn *iser_conn, int count) |
|
iser_conn->post_recv_buf_count += count; |
|
ret = ibv_post_recv(iser_conn->qp, iser_conn->rx_wr, &rx_wr_failed); |
|
if (ret) { |
|
- iscsi_set_error(iscsi, "ib_post_recv failed ret=%d", ret); |
|
+ iscsi_set_error(iscsi, "posting %d rx bufs, ib_post_recv failed ret=%d", count, ret); |
|
iser_conn->post_recv_buf_count -= count; |
|
} else |
|
iser_conn->rx_desc_head = my_rx_head; |
|
@@ -1028,7 +1028,7 @@ iser_rcv_completion(struct iser_rx_desc *rx_desc, |
|
struct iser_conn *iser_conn) |
|
{ |
|
struct iscsi_in_pdu *in = NULL; |
|
- int outstanding, count = 0, err; |
|
+ int empty, err; |
|
struct iscsi_context *iscsi = iser_conn->cma_id->context; |
|
|
|
in = iscsi_malloc(iscsi, sizeof(*in)); |
|
@@ -1037,12 +1037,13 @@ iser_rcv_completion(struct iser_rx_desc *rx_desc, |
|
if (iscsi->session_type == ISCSI_SESSION_NORMAL) { |
|
if(iser_alloc_rx_descriptors(iser_conn,255)) { |
|
iscsi_set_error(iscsi, "iser_alloc_rx_descriptors Failed\n"); |
|
- return -1; |
|
+ err = -1; |
|
+ goto error; |
|
} |
|
err = iser_post_recvm(iser_conn, ISER_MIN_POSTED_RX); |
|
if (err) { |
|
- iscsi_set_error(iscsi, "posting %d rx bufs err %d", count, err); |
|
- return -1; |
|
+ err = -1; |
|
+ goto error; |
|
} |
|
} |
|
in->hdr = (unsigned char*)rx_desc->iscsi_header; |
|
@@ -1089,34 +1090,27 @@ iser_rcv_completion(struct iser_rx_desc *rx_desc, |
|
ISCSI_LIST_ADD_END(&iser_conn->tx_desc, iser_pdu->desc); |
|
|
|
nop_target: |
|
- |
|
/* decrementing conn->post_recv_buf_count only --after-- freeing the * |
|
* task eliminates the need to worry on tasks which are completed in * |
|
* parallel to the execution of iser_conn_term. So the code that waits * |
|
* for the posted rx bufs refcount to become zero handles everything */ |
|
iser_conn->post_recv_buf_count--; |
|
|
|
- if ((unsigned char *)rx_desc == iser_conn->login_resp_buf) |
|
- goto receive; |
|
- |
|
- outstanding = iser_conn->post_recv_buf_count; |
|
- if (outstanding + iser_conn->min_posted_rx <= iser_conn->qp_max_recv_dtos) { |
|
- if(iser_conn->qp_max_recv_dtos - outstanding > iser_conn->min_posted_rx) |
|
- count = iser_conn->min_posted_rx; |
|
- else |
|
- count = iser_conn->qp_max_recv_dtos - outstanding; |
|
- err = iser_post_recvm(iser_conn, count); |
|
- if (err) { |
|
- iscsi_set_error(iscsi, "posting %d rx bufs err %d", count, err); |
|
- return -1; |
|
+ if ((unsigned char *)rx_desc != iser_conn->login_resp_buf) { |
|
+ empty = iser_conn->qp_max_recv_dtos - iser_conn->post_recv_buf_count; |
|
+ if (empty >= iser_conn->min_posted_rx) { |
|
+ err = iser_post_recvm(iser_conn, empty); |
|
+ if (err) { |
|
+ err = -1; |
|
+ goto error; |
|
+ } |
|
} |
|
} |
|
|
|
-receive: |
|
- |
|
err = iscsi_process_pdu(iscsi, in); |
|
- iscsi_free(iscsi, in); |
|
|
|
+error: |
|
+ iscsi_free(iscsi, in); |
|
return err; |
|
} |
|
|
|
diff --git a/lib/logging.c b/lib/logging.c |
|
index be518fc..61c7440 100644 |
|
--- a/lib/logging.c |
|
+++ b/lib/logging.c |
|
@@ -73,9 +73,9 @@ iscsi_log_message(struct iscsi_context *iscsi, int level, const char *format, .. |
|
} |
|
|
|
if (iscsi->target_name[0]) { |
|
- static char message2[1024]; |
|
+ static char message2[1282]; |
|
|
|
- snprintf(message2, 1024, "%s [%s]", message, iscsi->target_name); |
|
+ snprintf(message2, 1282, "%s [%s]", message, iscsi->target_name); |
|
iscsi->log_fn(level, message2); |
|
} |
|
else |
|
diff --git a/lib/scsi-lowlevel.c b/lib/scsi-lowlevel.c |
|
index 5ddd709..747ce0c 100644 |
|
--- a/lib/scsi-lowlevel.c |
|
+++ b/lib/scsi-lowlevel.c |
|
@@ -1086,6 +1086,7 @@ scsi_maintenancein_datain_getfullsize(struct scsi_task *task) |
|
(task_get_uint8(task, 1) & 0x80) ? 12 : 0 + |
|
task_get_uint16(task, 2); |
|
} |
|
+ return -1; |
|
default: |
|
return -1; |
|
} |
|
diff --git a/lib/sync.c b/lib/sync.c |
|
index f8a139c..0ceb0cb 100644 |
|
--- a/lib/sync.c |
|
+++ b/lib/sync.c |
|
@@ -88,10 +88,8 @@ iscsi_sync_cb(struct iscsi_context *iscsi _U_, int status, |
|
{ |
|
struct iscsi_sync_state *state = private_data; |
|
|
|
- if (state != NULL) { |
|
- state->status = status; |
|
- state->finished = 1; |
|
- } |
|
+ state->status = status; |
|
+ state->finished = 1; |
|
} |
|
|
|
int |
|
@@ -1871,11 +1869,9 @@ iscsi_discovery_cb(struct iscsi_context *iscsi _U_, int status, |
|
} |
|
} |
|
|
|
- if (state != NULL) { |
|
- state->status = status; |
|
- state->finished = 1; |
|
- state->ptr = dahead; |
|
- } |
|
+ state->status = status; |
|
+ state->finished = 1; |
|
+ state->ptr = dahead; |
|
} |
|
|
|
struct iscsi_discovery_address *
|
|
|