diff --git a/iscsi-scst/kernel/iscsi.c b/iscsi-scst/kernel/iscsi.c index 2237fa113..d06d88440 100644 --- a/iscsi-scst/kernel/iscsi.c +++ b/iscsi-scst/kernel/iscsi.c @@ -1825,7 +1825,7 @@ static int nop_out_start(struct iscsi_cmnd *cmnd) } /* We already checked it in check_segment_length() */ - sBUG_ON(cmnd->sg_cnt > (signed)ISCSI_CONN_IOV_MAX); + sBUG_ON(cmnd->sg_cnt > (signed int)ISCSI_CONN_IOV_MAX); cmnd->own_sg = 1; cmnd->bufflen = size; @@ -1844,7 +1844,7 @@ static int nop_out_start(struct iscsi_cmnd *cmnd) * accesses to dummy_page, since for ISCSI_RESERVED_TAG * the data only read and then discarded. */ - for (i = 0; i < (signed)ISCSI_CONN_IOV_MAX; i++) { + for (i = 0; i < (signed int)ISCSI_CONN_IOV_MAX; i++) { conn->read_iov[i].iov_base = page_address(dummy_page); tmp = min_t(u32, size, PAGE_SIZE); @@ -2043,7 +2043,7 @@ static int scsi_cmnd_start(struct iscsi_cmnd *req) atomic_inc(&session->active_cmds); req->dec_active_cmds = 1; - sBUG_ON(session->scst_sess == NULL); + EXTRACHECKS_BUG_ON(session->scst_sess == NULL); scst_cmd = scst_rx_cmd(session->scst_sess, (uint8_t *)&req_hdr->lun, sizeof(req_hdr->lun), diff --git a/iscsi-scst/kernel/isert-scst/iser.h b/iscsi-scst/kernel/isert-scst/iser.h index ccf1bd66e..7b8c0536d 100644 --- a/iscsi-scst/kernel/isert-scst/iser.h +++ b/iscsi-scst/kernel/isert-scst/iser.h @@ -99,7 +99,7 @@ struct isert_wr { struct ib_sge *sge_list; union { struct ib_recv_wr recv_wr; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) || defined(MOFED_MAJOR) struct ib_send_wr send_wr; #else struct ib_rdma_wr send_wr; diff --git a/iscsi-scst/kernel/isert-scst/iser_buf.c b/iscsi-scst/kernel/isert-scst/iser_buf.c index f6bc47fab..ae8b8c462 100644 --- a/iscsi-scst/kernel/isert-scst/iser_buf.c +++ b/iscsi-scst/kernel/isert-scst/iser_buf.c @@ -238,7 +238,7 @@ int isert_wr_init(struct isert_wr *wr, buff_offset = -EFAULT; goto out; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) || defined(MOFED_MAJOR) wr->send_wr.wr.rdma.remote_addr = pdu->rem_write_va + buff_offset; wr->send_wr.wr.rdma.rkey = pdu->rem_write_stag; @@ -255,7 +255,7 @@ int isert_wr_init(struct isert_wr *wr, buff_offset = -EFAULT; goto out; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) || defined(MOFED_MAJOR) wr->send_wr.wr.rdma.remote_addr = pdu->rem_read_va + buff_offset; wr->send_wr.wr.rdma.rkey = pdu->rem_read_stag; @@ -288,7 +288,7 @@ int isert_wr_init(struct isert_wr *wr, wr->recv_wr.sg_list = wr->sge_list; wr->recv_wr.num_sge = sg_cnt; } else { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) || defined(MOFED_MAJOR) wr->send_wr.next = NULL; wr->send_wr.wr_id = _ptr_to_u64(wr); wr->send_wr.sg_list = wr->sge_list; diff --git a/iscsi-scst/kernel/isert-scst/iser_pdu.c b/iscsi-scst/kernel/isert-scst/iser_pdu.c index 177b71f3b..25ee75ddd 100644 --- a/iscsi-scst/kernel/isert-scst/iser_pdu.c +++ b/iscsi-scst/kernel/isert-scst/iser_pdu.c @@ -214,7 +214,7 @@ out: static inline void isert_link_send_wrs(struct isert_wr *from_wr, struct isert_wr *to_wr) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) || defined(MOFED_MAJOR) from_wr->send_wr.next = &to_wr->send_wr; #else from_wr->send_wr.wr.next = &to_wr->send_wr.wr; @@ -226,7 +226,7 @@ static inline void isert_link_send_pdu_wrs(struct isert_cmnd *from_pdu, int wr_cnt) { isert_link_send_wrs(&from_pdu->wr[wr_cnt - 1], &to_pdu->wr[0]); -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) || defined(MOFED_MAJOR) to_pdu->wr[0].send_wr.next = NULL; #else to_pdu->wr[0].send_wr.wr.next = NULL; @@ -289,7 +289,7 @@ int isert_prepare_rdma(struct isert_cmnd *isert_pdu, isert_link_send_wrs(&isert_pdu->wr[i - 1], &isert_pdu->wr[i]); if (op == ISER_WR_RDMA_READ) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) || defined(MOFED_MAJOR) isert_pdu->wr[wr_cnt - 1].send_wr.send_flags = IB_SEND_SIGNALED; isert_pdu->wr[wr_cnt - 1].send_wr.next = NULL; #else @@ -588,7 +588,7 @@ int isert_pdu_send(struct isert_connection *isert_conn, #endif wr = &tx_pdu->wr[0]; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) || defined(MOFED_MAJOR) wr->send_wr.num_sge = isert_pdu_prepare_send(isert_conn, tx_pdu); #else wr->send_wr.wr.num_sge = isert_pdu_prepare_send(isert_conn, tx_pdu); @@ -613,7 +613,7 @@ int isert_pdu_post_rdma_write(struct isert_connection *isert_conn, TRACE_ENTRY(); -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) || defined(MOFED_MAJOR) isert_rsp->wr[0].send_wr.num_sge = isert_pdu_prepare_send(isert_conn, isert_rsp); #else diff --git a/iscsi-scst/kernel/isert-scst/iser_rdma.c b/iscsi-scst/kernel/isert-scst/iser_rdma.c index b0172e7c7..7699abc74 100644 --- a/iscsi-scst/kernel/isert-scst/iser_rdma.c +++ b/iscsi-scst/kernel/isert-scst/iser_rdma.c @@ -111,7 +111,7 @@ int isert_post_send(struct isert_connection *isert_conn, struct isert_wr *first_wr, int num_wr) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) || defined(MOFED_MAJOR) struct ib_send_wr *first_ib_wr = &first_wr->send_wr; #else struct ib_send_wr *first_ib_wr = &first_wr->send_wr.wr; @@ -150,7 +150,7 @@ static void isert_post_drain_sq(struct isert_connection *isert_conn) isert_wr_set_fields(drain_wr_sq, isert_conn, NULL); drain_wr_sq->wr_op = ISER_WR_SEND; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) || defined(MOFED_MAJOR) drain_wr_sq->send_wr.wr_id = _ptr_to_u64(drain_wr_sq); drain_wr_sq->send_wr.opcode = IB_WR_SEND; err = ib_post_send(isert_conn->qp, @@ -704,7 +704,7 @@ static void isert_handle_wc_error(struct ib_wc *wc) switch (wr->wr_op) { case ISER_WR_SEND: -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) || defined(MOFED_MAJOR) num_sge = wr->send_wr.num_sge; #else num_sge = wr->send_wr.wr.num_sge; @@ -965,7 +965,7 @@ static struct isert_device *isert_device_create(struct ib_device *ib_dev) goto out; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0) || defined(MOFED_MAJOR) err = ib_query_device(ib_dev, &isert_dev->device_attr); if (unlikely(err)) { PRINT_ERROR("Failed to query device, err: %d", err); @@ -1783,7 +1783,7 @@ struct isert_portal *isert_portal_create(void) #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0) && \ (!defined(RHEL_MAJOR) || RHEL_MAJOR -0 <= 5) cm_id = rdma_create_id(isert_cm_evt_handler, portal, RDMA_PS_TCP); -#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) +#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) || defined(MOFED_MAJOR) cm_id = rdma_create_id(isert_cm_evt_handler, portal, RDMA_PS_TCP, IB_QPT_RC); #else diff --git a/scst/README b/scst/README index b2fff1aef..4b380b61a 100644 --- a/scst/README +++ b/scst/README @@ -2120,7 +2120,7 @@ IMPORTANT: Since data in BLOCKIO and FILEIO modes are not consistent between simultaneously, you will almost instantly corrupt your data on that device. -IMPORTANT: Some kernels starting from 2.6.32 have a problem, which prevents +IMPORTANT: Some kernels starting from 2.6.32 have a problem, which ========= prevents BLOCKIO from working correctly with RAID5/DM. See http://lkml.org/lkml/2010/7/28/315. That problem was fixed in 2.6.32.19, 2.6.34.4, 2.6.35.2 and 2.6.36-rc1. It is strongly diff --git a/scst/src/scst_copy_mgr.c b/scst/src/scst_copy_mgr.c index f367da21f..825cd8698 100644 --- a/scst/src/scst_copy_mgr.c +++ b/scst/src/scst_copy_mgr.c @@ -2530,6 +2530,7 @@ static unsigned int scst_cm_get_lun(const struct scst_device *dev) for (i = 0; i < SESS_TGT_DEV_LIST_HASH_SIZE; i++) { struct list_head *head = &scst_cm_sess->sess_tgt_dev_list[i]; struct scst_tgt_dev *tgt_dev; + list_for_each_entry(tgt_dev, head, sess_tgt_dev_list_entry) { if (tgt_dev->dev == dev) { res = tgt_dev->lun; diff --git a/scst/src/scst_targ.c b/scst/src/scst_targ.c index cbed2c8a8..455d37ebf 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -1919,6 +1919,7 @@ static void scst_process_redirect_cmd(struct scst_cmd *cmd, case SCST_CONTEXT_THREAD: { struct list_head *active_cmd_list; + if (cmd->cmd_thr != NULL) { TRACE_DBG("Using assigned thread %p for cmd %p", cmd->cmd_thr, cmd); @@ -5503,6 +5504,7 @@ int scst_cmd_thread(void *arg) while (!kthread_should_stop()) { if (!test_cmd_threads(thr)) { DEFINE_WAIT(wait); + do { prepare_to_wait_exclusive_head( &p_cmd_threads->cmd_list_waitQ, diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index e8fce3d29..660d6d7be 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -113,12 +113,12 @@ static u16 rdma_cm_port; module_param(rdma_cm_port, short, 0444); MODULE_PARM_DESC(rdma_cm_port, "Port number RDMA/CM will bind to."); -static unsigned srp_max_rdma_size = DEFAULT_MAX_RDMA_SIZE; +static unsigned int srp_max_rdma_size = DEFAULT_MAX_RDMA_SIZE; module_param(srp_max_rdma_size, int, 0644); MODULE_PARM_DESC(srp_max_rdma_size, "Maximum size of SRP RDMA transfers for new connections."); -static unsigned srp_max_req_size = DEFAULT_MAX_REQ_SIZE; +static unsigned int srp_max_req_size = DEFAULT_MAX_REQ_SIZE; module_param(srp_max_req_size, int, 0444); MODULE_PARM_DESC(srp_max_req_size, "Maximum size of SRP request messages in bytes."); @@ -181,7 +181,7 @@ MODULE_PARM_DESC(srpt_service_guid, "Using this value for ioc_guid, id_ext, and cm_listen_id" " instead of using the node_guid of the first HCA."); -static unsigned max_sge_delta = 3; +static unsigned int max_sge_delta = 3; module_param(max_sge_delta, uint, 0444); MODULE_PARM_DESC(max_sge_delta, "Number to subtract from max_sge."); @@ -599,7 +599,7 @@ static void srpt_mad_send_handler(struct ib_mad_agent *mad_agent, * srpt_mad_recv_handler() - MAD reception callback function. */ static void srpt_mad_recv_handler(struct ib_mad_agent *mad_agent, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0) && !defined(MOFED_MAJOR) struct ib_mad_send_buf *send_buf, #endif struct ib_mad_recv_wc *mad_wc) @@ -626,9 +626,8 @@ static void srpt_mad_recv_handler(struct ib_mad_agent *mad_agent, #endif 0, IB_MGMT_DEVICE_HDR, IB_MGMT_DEVICE_DATA, GFP_KERNEL -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) || \ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) && !defined(MOFED_MAJOR) || \ defined(CREATE_SEND_MAD_HAS_BASE_ARG) - , 0 #endif ); @@ -1059,7 +1058,7 @@ static int srpt_get_desc_tbl(struct srpt_recv_ioctx *recv_ioctx, { struct srp_indirect_buf *idb; struct srp_direct_buf *db; - unsigned add_cdb_offset; + unsigned int add_cdb_offset; int ret; u8 fmt; @@ -2259,7 +2258,8 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch) */ ch->max_sge = sdev->dev_attr.max_sge - min(max_sge_delta, - max_t(unsigned, 0, sdev->dev_attr.max_sge - max_sge_delta)); + max_t(unsigned int, 0, + sdev->dev_attr.max_sge - max_sge_delta)); qp_init->cap.max_send_sge = ch->max_sge; qp_init->cap.max_recv_sge = ch->max_sge; if (sdev->use_srq) { @@ -3382,7 +3382,7 @@ static int srpt_perform_rdmas(struct srpt_rdma_ch *ch, struct srpt_send_ioctx *ioctx, scst_data_direction dir) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) || defined(MOFED_MAJOR) struct ib_send_wr wr; #else struct ib_rdma_wr wr; @@ -3407,7 +3407,7 @@ static int srpt_perform_rdmas(struct srpt_rdma_ch *ch, memset(&wr, 0, sizeof(wr)); for (i = 0; i < n_rdma; ++i, ++riu) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) || defined(MOFED_MAJOR) if (dir == SCST_DATA_READ) { wr.opcode = IB_WR_RDMA_WRITE; wr.wr_id = encode_wr_id(i == n_rdma - 1 ? @@ -3466,7 +3466,7 @@ static int srpt_perform_rdmas(struct srpt_rdma_ch *ch, pr_err("%s: ib_post_send() returned %d for %d/%d\n", __func__, ret, i, n_rdma); if (ret && i > 0) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) || defined(MOFED_MAJOR) wr.num_sge = 0; wr.wr_id = encode_wr_id(SRPT_RDMA_ABORT, ioctx->ioctx.index); wr.send_flags = IB_SEND_SIGNALED; @@ -3493,7 +3493,7 @@ static int srpt_perform_rdmas(struct srpt_rdma_ch *ch, #endif pr_info("Waiting until RDMA abort finished [%d]\n", ioctx->ioctx.index); -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) || defined(MOFED_MAJOR) while (ch->state < CH_DISCONNECTED && !ioctx->rdma_aborted) { pr_info("Waiting until RDMA abort finished [%d]\n", ioctx->ioctx.index); @@ -4329,7 +4329,7 @@ static void srpt_add_one(struct ib_device *device) sdev->device = device; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0) || defined(MOFED_MAJOR) ret = ib_query_device(device, &sdev->dev_attr); if (ret) { pr_err("ib_query_device() failed: %d\n", ret); @@ -4417,7 +4417,7 @@ static void srpt_add_one(struct ib_device *device) * if this HCA is gone bad and replaced by different HCA */ ret = ib_cm_listen(sdev->cm_id, cpu_to_be64(srpt_service_guid), 0 -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) || defined(MOFED_MAJOR) , NULL #endif ); @@ -4489,7 +4489,7 @@ err: /** * srpt_remove_one() - InfiniBand device removal callback function. */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) || defined(MOFED_MAJOR) static void srpt_remove_one(struct ib_device *device) { void *client_data = ib_get_client_data(device, &srpt_client); @@ -4671,7 +4671,7 @@ static int __init srpt_init_module(void) (!defined(RHEL_MAJOR) || RHEL_MAJOR -0 < 6) rdma_cm_id = rdma_create_id(srpt_rdma_cm_handler, NULL, RDMA_PS_TCP); -#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) +#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) || defined(MOFED_MAJOR) rdma_cm_id = rdma_create_id(srpt_rdma_cm_handler, NULL, RDMA_PS_TCP, IB_QPT_RC); #else diff --git a/srpt/src/ib_srpt.h b/srpt/src/ib_srpt.h index 4dea3fbfb..70c2c1c4c 100644 --- a/srpt/src/ib_srpt.h +++ b/srpt/src/ib_srpt.h @@ -119,7 +119,7 @@ enum { SRP_LOGIN_RSP_MULTICHAN_MAINTAINED = 0x2, MIN_SRPT_SQ_SIZE = 16, - DEF_SRPT_SQ_SIZE = 4096, + DEF_SRPT_SQ_SIZE = 256, SRPT_RQ_SIZE = 128, MIN_SRPT_SRQ_SIZE = 4, DEFAULT_SRPT_SRQ_SIZE = 4095,