From c41a8784888be60dc8266f87d683fc4f40015237 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Fri, 11 Mar 2016 03:35:11 +0000 Subject: [PATCH] Merged revisions 6777,6801,6806,6815 via svnmerge from svn+ssh://svn.code.sf.net/p/scst/svn/trunk git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/3.1.x@6829 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- iscsi-scst/kernel/nthread.c | 30 +++++++++++++++--------------- qla2x00t/qla2x00-target/qla2x00t.c | 4 ++-- scst/README | 14 +++++++------- scst/README_in-tree | 14 +++++++------- scst/src/dev_handlers/scst_vdisk.c | 10 ++++++++-- 5 files changed, 39 insertions(+), 33 deletions(-) diff --git a/iscsi-scst/kernel/nthread.c b/iscsi-scst/kernel/nthread.c index 2d6333229..334dd3daa 100644 --- a/iscsi-scst/kernel/nthread.c +++ b/iscsi-scst/kernel/nthread.c @@ -81,7 +81,6 @@ again: spin_lock_bh(&conn->cmd_list_lock); list_for_each_entry(cmnd, &conn->cmd_list, cmd_list_entry) { struct iscsi_cmnd *rsp; - int restart = 0; TRACE_CONN_CLOSE_DBG("cmd %p, scst_state %x, " "r2t_len_to_receive %d, ref_cnt %d, parent_req %p, " @@ -98,6 +97,12 @@ again: if (cmnd_get_check(cmnd)) continue; + /* + * If we don't unlock here, we are risking to get into + * recursive deadlock in cmnd_done() called from cmnd_put() + */ + spin_unlock_bh(&conn->cmd_list_lock); + for (i = 0; i < cmnd->sg_cnt; i++) { struct page *page = sg_page(&cmnd->sg[i]); @@ -106,18 +111,12 @@ again: atomic_read(&page->_count)); if (page->net_priv != NULL) { - if (restart == 0) { - spin_unlock_bh(&conn->cmd_list_lock); - restart = 1; - } while (page->net_priv != NULL) iscsi_put_page_callback(page); } } cmnd_put(cmnd); - - if (restart) - goto again; + goto again; } list_for_each_entry(rsp, &cmnd->rsp_cmd_list, @@ -133,6 +132,13 @@ again: if (cmnd_get_check(rsp)) continue; + /* + * If we don't unlock here, we are risking to + * get into recursive deadlock in cmnd_done() + * called from cmnd_put() + */ + spin_unlock_bh(&conn->cmd_list_lock); + for (i = 0; i < rsp->sg_cnt; i++) { struct page *page = sg_page(&rsp->sg[i]); @@ -143,18 +149,12 @@ again: atomic_read(&page->_count)); if (page->net_priv != NULL) { - if (restart == 0) { - spin_unlock_bh(&conn->cmd_list_lock); - restart = 1; - } while (page->net_priv != NULL) iscsi_put_page_callback(page); } } cmnd_put(rsp); - - if (restart) - goto again; + goto again; } } } diff --git a/qla2x00t/qla2x00-target/qla2x00t.c b/qla2x00t/qla2x00-target/qla2x00t.c index dad9e2711..036302411 100644 --- a/qla2x00t/qla2x00-target/qla2x00t.c +++ b/qla2x00t/qla2x00-target/qla2x00t.c @@ -5610,7 +5610,7 @@ static void q2t_response_pkt(scsi_qla_host_t *vha, response_t *pkt) */ q24_retry_term_exchange(vha, entry); } else - PRINT_ERROR("qla2x00t(%ld): ABTS_RESP_24XX " + PRINT_WARNING("qla2x00t(%ld): ABTS_RESP_24XX " "failed %x (subcode %x:%x)", vha->host_no, entry->compl_status, entry->error_subcode1, entry->error_subcode2); @@ -5815,7 +5815,7 @@ retry: "S_ID %x:%x:%x", s_id[0], s_id[1], s_id[2]); } else - PRINT_ERROR("qla2x00t(%ld): Unable to find " + PRINT_WARNING("qla2x00t(%ld): Unable to find " "initiator with S_ID %x:%x:%x", vha->host_no, s_id[0], s_id[1], s_id[2]); diff --git a/scst/README b/scst/README index 03ca4e87f..b6ca4f3b8 100644 --- a/scst/README +++ b/scst/README @@ -1638,14 +1638,14 @@ perform actual path state switching on SET TARGET PORT GROUPS command, for instance, by calling drbdadm. For more information see stpgd README as well as sample script scst_on_stpg. -DRBD compatibility -.................. +DRBD and other replication/failover SW compatibility +.................................................... -DRBD does not allow to open its device on the secondary as well as does -not allow to perform primary to secondary transition, if this device is -open. +DRBD as well as other replication/failover SW does not allow to open its +device on the secondary as well as does not allow to perform primary to +secondary transition, if this device is open. -SCST BLOCKIO handler has all the necessary support for this behavior. If +SCST BLOCKIO handler has all the necessary support for such behavior. If you write new ALUA state in the "state" attribute, SCST BLOCKIO handler before transition closes the open devices' handles and after transition reopens them, if the new state is active or nonoptimized. @@ -1659,7 +1659,7 @@ above). Wait until the blocking finished. 2. Change the ALUA state to "transitioning". At this moment all open file handles will be closed. -3. Perform the DRBD state transition +3. Perform the DRBD or other replication/failover SW state transition 4. Change the ALUA state to your desired secondary state. diff --git a/scst/README_in-tree b/scst/README_in-tree index 669f97f44..0b62d61e7 100644 --- a/scst/README_in-tree +++ b/scst/README_in-tree @@ -1491,14 +1491,14 @@ perform actual path state switching on SET TARGET PORT GROUPS command, for instance, by calling drbdadm. For more information see stpgd README as well as sample script scst_on_stpg. -DRBD compatibility -.................. +DRBD and other replication/failover SW compatibility +.................................................... -DRBD does not allow to open its device on the secondary as well as does -not allow to perform primary to secondary transition, if this device is -open. +DRBD as well as other replication/failover SW does not allow to open its +device on the secondary as well as does not allow to perform primary to +secondary transition, if this device is open. -SCST BLOCKIO handler has all the necessary support for this behavior. If +SCST BLOCKIO handler has all the necessary support for such behavior. If you write new ALUA state in the "state" attribute, SCST BLOCKIO handler before transition closes the open devices' handles and after transition reopens them, if the new state is active or nonoptimized. @@ -1512,7 +1512,7 @@ above). Wait until the blocking finished. 2. Change the ALUA state to "transitioning". At this moment all open file handles will be closed. -3. Perform the DRBD state transition +3. Perform the DRBD or other replication/failover SW state transition 4. Change the ALUA state to your desired secondary state. diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 29d260e69..812466490 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -3615,7 +3615,13 @@ static int blockio_exec(struct scst_cmd *cmd) if (unlikely(virt_dev->fd == NULL)) { if (!vdisk_no_fd_allowed_commands(cmd)) { - /* We should not get here */ + /* + * We should not get here, unless the user space + * misconfiguring something, e.g. set optimized + * ALUA state for secondary DRBD device. See + * "DRBD and other replication/failover SW + * compatibility" section in SCST README. + */ PRINT_WARNING("Closed FD on exec. Secondary DRBD or not " "blocked dev before ALUA state change? " "(cmd %p, op %s, dev %s)", cmd, cmd->op_name, @@ -8674,7 +8680,7 @@ out: return res; out_free: - kfree(buf); + kfree(new_size); goto out; }