From 9e35afe1e029f300a68469ce590fb3ea6390f58a Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 27 Aug 2017 15:28:57 +0000 Subject: [PATCH 1/3] Annotate fall-through in switch statements in a form recognized by gcc 7 git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7216 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- iscsi-scst/kernel/iscsi.c | 2 +- iscsi-scst/kernel/nthread.c | 6 +++--- mpt/mpt_scst.c | 2 +- mvsas_tgt/mv_tgt.c | 2 +- qla2x00t/qla2x00-target/qla2x00t.c | 2 +- qla2x00t/qla_isr.c | 4 ++-- scst/src/dev_handlers/scst_user.c | 4 ++-- scst/src/scst_lib.c | 11 ++++++----- scst/src/scst_targ.c | 12 ++++++------ usr/events/events.c | 2 +- usr/fileio/fileio.c | 2 +- usr/stpgd/stpgd_main.c | 2 +- 12 files changed, 26 insertions(+), 25 deletions(-) diff --git a/iscsi-scst/kernel/iscsi.c b/iscsi-scst/kernel/iscsi.c index 8b25dc070..c4c8d1f1e 100644 --- a/iscsi-scst/kernel/iscsi.c +++ b/iscsi-scst/kernel/iscsi.c @@ -3410,7 +3410,7 @@ static void iscsi_try_local_processing(struct iscsi_cmnd *req) switch (conn->wr_state) { case ISCSI_CONN_WR_STATE_IN_LIST: list_del(&conn->wr_list_entry); - /* go through */ + /* fall through */ case ISCSI_CONN_WR_STATE_IDLE: #ifdef CONFIG_SCST_EXTRACHECKS conn->wr_task = current; diff --git a/iscsi-scst/kernel/nthread.c b/iscsi-scst/kernel/nthread.c index 082418e74..24b481c6d 100644 --- a/iscsi-scst/kernel/nthread.c +++ b/iscsi-scst/kernel/nthread.c @@ -863,7 +863,7 @@ static int process_read_io(struct iscsi_conn *conn, int *closed) iscsi_conn_init_read(cmnd->conn, &cmnd->pdu.bhs, sizeof(cmnd->pdu.bhs)); conn->read_state = RX_BHS; - /* go through */ + /* fall through */ case RX_BHS: res = do_recv(conn); @@ -976,7 +976,7 @@ static int process_read_io(struct iscsi_conn *conn, int *closed) case RX_INIT_HDIGEST: iscsi_conn_init_read(conn, &cmnd->hdigest, sizeof(u32)); conn->read_state = RX_CHECK_HDIGEST; - /* go through */ + /* fall through */ case RX_CHECK_HDIGEST: res = do_recv(conn); @@ -996,7 +996,7 @@ static int process_read_io(struct iscsi_conn *conn, int *closed) case RX_INIT_DDIGEST: iscsi_conn_init_read(conn, &cmnd->ddigest, sizeof(u32)); conn->read_state = RX_CHECK_DDIGEST; - /* go through */ + /* fall through */ case RX_CHECK_DDIGEST: res = iscsi_rx_check_ddigest(conn); diff --git a/mpt/mpt_scst.c b/mpt/mpt_scst.c index 6fe26b01a..0c4a6902b 100644 --- a/mpt/mpt_scst.c +++ b/mpt/mpt_scst.c @@ -1013,7 +1013,7 @@ out_free_sess: if (atomic_dec_and_test(&tgt->sess_count)) wake_up_all(&tgt->waitQ); - /* go through */ + /* fall through */ out_free_cmd: TRACE_MEM("kfree for cmd %p", cmd); kfree(cmd); diff --git a/mvsas_tgt/mv_tgt.c b/mvsas_tgt/mv_tgt.c index 962c88b13..6589ecb51 100644 --- a/mvsas_tgt/mv_tgt.c +++ b/mvsas_tgt/mv_tgt.c @@ -1603,7 +1603,7 @@ out_free_sess: tgt->sess_count--; if (tgt->sess_count == 0) wake_up_all(&tgt->waitQ); - /* go through */ + /* fall through */ out_free_cmd: mvst_free_cmd(cmd); diff --git a/qla2x00t/qla2x00-target/qla2x00t.c b/qla2x00t/qla2x00-target/qla2x00t.c index 2903ded28..8beedfe78 100644 --- a/qla2x00t/qla2x00-target/qla2x00t.c +++ b/qla2x00t/qla2x00-target/qla2x00t.c @@ -1530,7 +1530,7 @@ out_free_sess_wwn: spin_unlock_irq(&ha->hardware_lock); kfree(wwn_str); - /* go through */ + /* fall through */ out_free_sess: kmem_cache_free(q2t_sess_cachep, sess); diff --git a/qla2x00t/qla_isr.c b/qla2x00t/qla_isr.c index a24098631..55cbde498 100644 --- a/qla2x00t/qla_isr.c +++ b/qla2x00t/qla_isr.c @@ -883,7 +883,7 @@ skip_rio: case MBA_CHG_IN_CONNECTION: /* Change in connection mode */ if (IS_QLA2100(ha)) break; - /* else go through */ + /* fall through */ case MBA_RESET: /* Reset */ case MBA_SYSTEM_ERR: /* System Error */ case MBA_REQ_TRANSFER_ERR: /* Request Transfer Error */ @@ -2260,7 +2260,7 @@ void qla24xx_process_response_queue(struct scsi_qla_host *vha, case ABTS_RECV_24XX: /* ensure that the ATIO queue is empty */ qla24xx_process_atio_queue(vha); - /* go through */ + /* fall through */ case ABTS_RESP_24XX: case CTIO_TYPE7: case NOTIFY_ACK_TYPE: diff --git a/scst/src/dev_handlers/scst_user.c b/scst/src/dev_handlers/scst_user.c index 6f94728e9..5decbc2da 100644 --- a/scst/src/dev_handlers/scst_user.c +++ b/scst/src/dev_handlers/scst_user.c @@ -795,7 +795,7 @@ static int dev_user_parse(struct scst_cmd *cmd) res = SCST_CMD_STATE_NEED_THREAD_CTX; goto out; } - /* else go through */ + /* fall through */ case SCST_USER_PARSE_CALL: TRACE_DBG("Preparing PARSE for user space (ucmd=%p, h=%d, " @@ -1296,7 +1296,7 @@ out: out_nomem: if (ucmd->cmd != NULL) scst_set_busy(ucmd->cmd); - /* go through */ + /* fall through */ out_err: if (ucmd->cmd != NULL) diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index dfedd150c..3c28e6aaf 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -3068,7 +3068,7 @@ int scst_get_cmd_abnormal_done_state(struct scst_cmd *cmd) break; } trace = true; - /* go through */ + /* fall through */ case SCST_CMD_STATE_DEV_DONE: if (cmd->internal) res = SCST_CMD_STATE_FINISHED_INTERNAL; @@ -3102,7 +3102,8 @@ int scst_get_cmd_abnormal_done_state(struct scst_cmd *cmd) if (cmd->preprocessing_only) { res = SCST_CMD_STATE_PREPROCESSING_DONE; break; - } /* else go through */ + } + /* fall through */ case SCST_CMD_STATE_RDY_TO_XFER: case SCST_CMD_STATE_DATA_WAIT: case SCST_CMD_STATE_TGT_PRE_EXEC: @@ -9332,7 +9333,7 @@ static int scst_do_dif(struct scst_cmd *cmd, case SCST_DIF_CHECK_REF_TAG: default: EXTRACHECKS_BUG_ON(1); - /* go through */ + /* fall through */ case SCST_DIF_ACTION_NONE: /* Nothing to do */ TRACE_DBG("NONE DIF action, skipping (cmd %p)", cmd); @@ -10584,7 +10585,7 @@ static int __scst_parse_vrprotect(struct scst_cmd *cmd, int vrprotect_offs) cmd->cmd_dif_actions = 0; break; } - /* else go through */ + /* fall through */ case 1: case 5: cmd->cmd_dif_actions = SCST_DIF_CHECK_GUARD_TAG | @@ -13566,7 +13567,7 @@ static void scst_process_qerr(struct scst_cmd *cmd) default: PRINT_WARNING("Invalid QErr value %x for device %s, process as " "0", qerr, dev->virt_name); - /* go through */ + /* fall through */ case SCST_QERR_0_ALL_RESUME: /* Nothing to do */ break; diff --git a/scst/src/scst_targ.c b/scst/src/scst_targ.c index 344a71bc0..d16427082 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -910,7 +910,7 @@ active: default: PRINT_ERROR("Context %x is undefined, using the thread one", pref_context); - /* go through */ + /* fall through */ case SCST_CONTEXT_THREAD: spin_lock_irqsave(&cmd->cmd_threads->cmd_list_lock, flags); TRACE_DBG("Adding cmd %p to active cmd list", cmd); @@ -1360,7 +1360,7 @@ set_res: TRACE_DBG_FLAG(TRACE_DEBUG|TRACE_MINOR, "Atomic context and " "non-WRITE data direction, rescheduling (cmd %p)", cmd); res = SCST_CMD_STATE_RES_NEED_THREAD; - /* go through */ + /* fall through */ } #endif @@ -1741,7 +1741,7 @@ void scst_restart_cmd(struct scst_cmd *cmd, int status, set_bit(SCST_CMD_ABORTED, &cmd->cmd_flags); set_bit(SCST_CMD_NO_RESP, &cmd->cmd_flags); cmd->delivery_status = SCST_CMD_DELIVERY_FAILED; - /* go through */ + /* fall through */ case SCST_PREPROCESS_STATUS_ERROR: if (cmd->sense != NULL) scst_set_cmd_error(cmd, @@ -1913,7 +1913,7 @@ static void scst_process_redirect_cmd(struct scst_cmd *cmd, default: PRINT_ERROR("Context %x is unknown, using the thread one", context); - /* go through */ + /* fall through */ case SCST_CONTEXT_THREAD: { struct list_head *active_cmd_list; @@ -2015,7 +2015,7 @@ void scst_rx_data(struct scst_cmd *cmd, int status, set_bit(SCST_CMD_ABORTED, &cmd->cmd_flags); set_bit(SCST_CMD_NO_RESP, &cmd->cmd_flags); cmd->delivery_status = SCST_CMD_DELIVERY_FAILED; - /* go through */ + /* fall through */ case SCST_RX_STATUS_ERROR: TRACE(TRACE_SCSI, "cmd %p, RX data error status %#x", cmd, status); if (!cmd->write_not_received_set) @@ -2149,7 +2149,7 @@ static int scst_tgt_pre_exec(struct scst_cmd *cmd) set_bit(SCST_CMD_ABORTED, &cmd->cmd_flags); set_bit(SCST_CMD_NO_RESP, &cmd->cmd_flags); cmd->delivery_status = SCST_CMD_DELIVERY_FAILED; - /* go through */ + /* fall through */ case SCST_PREPROCESS_STATUS_ERROR: scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error)); diff --git a/usr/events/events.c b/usr/events/events.c index 4cdf896e4..5cc1ca561 100644 --- a/usr/events/events.c +++ b/usr/events/events.c @@ -213,7 +213,7 @@ int main(int argc, char **argv) case EBUSY: TRACE_MGMT_DBG("SCST_EVENT_GET_NEXT_EVENT returned " "%d (%s)", res, strerror(res)); - /* go through */ + /* fall through */ case EINTR: continue; case EAGAIN: diff --git a/usr/fileio/fileio.c b/usr/fileio/fileio.c index bd97594fa..34fe90e9c 100644 --- a/usr/fileio/fileio.c +++ b/usr/fileio/fileio.c @@ -492,7 +492,7 @@ out_unreg: res = errno; PRINT_ERROR("Unable to unregister device: %s", strerror(res)); - /* go through */ + /* fall through */ } } close(devs[i].scst_usr_fd); diff --git a/usr/stpgd/stpgd_main.c b/usr/stpgd/stpgd_main.c index a99b87b20..a2d8bcc35 100644 --- a/usr/stpgd/stpgd_main.c +++ b/usr/stpgd/stpgd_main.c @@ -344,7 +344,7 @@ static int stpg_event_loop(void) case EBUSY: TRACE_MGMT_DBG("SCST_EVENT_GET_NEXT_EVENT " "returned %d (%s)", res, strerror(res)); - /* go through */ + /* fall through */ case EINTR: continue; case EAGAIN: From 617c48e1382f20693b5ad35214d1d7f38db7d28d Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 27 Aug 2017 15:40:42 +0000 Subject: [PATCH 2/3] scst: More fall-through annotations for gcc 7 git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7217 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/dev_handlers/scst_vdisk.c | 2 +- scst/src/scst_targ.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 0f1102235..8c3c3b427 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -2941,7 +2941,7 @@ static bool vdisk_use_zero_copy(const struct scst_cmd *cmd) case VARIABLE_LENGTH_CMD: if (cmd->cdb[9] != SUBCODE_READ_32) break; - /* else go througth */ + /* fall through */ case READ_6: case READ_10: case READ_12: diff --git a/scst/src/scst_targ.c b/scst/src/scst_targ.c index d16427082..d6c14cb2c 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -3856,7 +3856,7 @@ defer: case SCST_QERR_3_ABORT_THIS_NEXUS_ONLY: if (!this_nex) goto defer; - /* else go through */ + /* fall through */ case SCST_QERR_1_ABORT_ALL: TRACE_MGMT_DBG("Aborting cmd %p due to " "ACA active (tgt_dev %p)", cmd, From 1e457529eb4510bccd00be9246aa1765f079037f Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 27 Aug 2017 15:40:59 +0000 Subject: [PATCH 3/3] ib_srpt: Port to Linux kernel v4.12 git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7218 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- srpt/Makefile | 6 ++++++ srpt/conftest/rdma_destroy_ah/Makefile | 3 +++ srpt/conftest/rdma_destroy_ah/rdma_destroy_ah.c | 10 ++++++++++ srpt/src/ib_srpt.c | 9 +++++++++ 4 files changed, 28 insertions(+) create mode 100644 srpt/conftest/rdma_destroy_ah/Makefile create mode 100644 srpt/conftest/rdma_destroy_ah/rdma_destroy_ah.c diff --git a/srpt/Makefile b/srpt/Makefile index 214edee8f..03da0fa18 100644 --- a/srpt/Makefile +++ b/srpt/Makefile @@ -236,6 +236,12 @@ conftest/rdma_create_id_net/result-$(KVER).txt: \ echo "$(call run_conftest_bool,rdma_create_id_net, \ RDMA_CREATE_ID_TAKES_NET_ARG)" >"$@" +conftest/rdma_destroy_ah/result-$(KVER).txt: \ + conftest/rdma_destroy_ah/rdma_destroy_ah.c \ + conftest/rdma_destroy_ah/Makefile + echo "$(call run_conftest_bool,rdma_destroy_ah, \ + HAVE_RDMA_DESTROY_AH)" >"$@" + conftest/register_mad_agent/result-$(KVER).txt: \ conftest/register_mad_agent/register_mad_agent.c \ conftest/register_mad_agent/Makefile diff --git a/srpt/conftest/rdma_destroy_ah/Makefile b/srpt/conftest/rdma_destroy_ah/Makefile new file mode 100644 index 000000000..2693ee734 --- /dev/null +++ b/srpt/conftest/rdma_destroy_ah/Makefile @@ -0,0 +1,3 @@ +LINUXINCLUDE := $(PRE_CFLAGS) $(LINUXINCLUDE) + +obj-m += rdma_destroy_ah.o diff --git a/srpt/conftest/rdma_destroy_ah/rdma_destroy_ah.c b/srpt/conftest/rdma_destroy_ah/rdma_destroy_ah.c new file mode 100644 index 000000000..375474f54 --- /dev/null +++ b/srpt/conftest/rdma_destroy_ah/rdma_destroy_ah.c @@ -0,0 +1,10 @@ +#include +#include + +static int modinit(void) +{ + return rdma_destroy_ah(NULL) != 0; + +} + +module_init(modinit); diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index c65c76b15..fe7fe72cb 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -589,7 +589,11 @@ static void srpt_mgmt_method_get(struct srpt_port *sp, struct ib_mad *rq_mad, static void srpt_mad_send_handler(struct ib_mad_agent *mad_agent, struct ib_mad_send_wc *mad_wc) { +#ifdef HAVE_RDMA_DESTROY_AH + rdma_destroy_ah(mad_wc->send_buf->ah); +#else ib_destroy_ah(mad_wc->send_buf->ah); +#endif ib_free_send_mad(mad_wc->send_buf); } @@ -661,7 +665,12 @@ static void srpt_mad_recv_handler(struct ib_mad_agent *mad_agent, ib_free_send_mad(rsp); err_rsp: +#ifdef HAVE_RDMA_DESTROY_AH + rdma_destroy_ah(ah); +#else ib_destroy_ah(ah); +#endif + err: ib_free_recv_mad(mad_wc); }