From patchwork Tue Aug 17 09:14:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 499358 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5BC30C432BE for ; Tue, 17 Aug 2021 09:17:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 472E760F11 for ; Tue, 17 Aug 2021 09:17:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239856AbhHQJSA (ORCPT ); Tue, 17 Aug 2021 05:18:00 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:47664 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239488AbhHQJRU (ORCPT ); Tue, 17 Aug 2021 05:17:20 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 7DC5020025; Tue, 17 Aug 2021 09:16:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1629191802; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jwU5Uji0VGmmIm0tuyQivcxGQu+jcrA2PzTb90fYs9c=; b=ewpO802Cevls+dsg1YHaHOzCo7q2o1MuN5HtzZVNuwSOHb3jIRgJXd4+bCXPBHZAddGMMf ftKjlZ6UZk8VQs1y4UoDYw2nA5JWDkyJFCsDMbNCeR2Dkiznn6C5JUQUZI8NlvsPCxSsK8 vnn33r+vxlFpnAGyK/5TSHVMl2LlPi0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1629191802; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jwU5Uji0VGmmIm0tuyQivcxGQu+jcrA2PzTb90fYs9c=; b=JCUQ2JHbwFbOQVnZtmiWBJMzOpF6Bq0F7Zh1OaVIztQLOkd/UPbdA6nxgSk5StWOfVSaL0 4tpnHqPfENIJbVAQ== Received: from adalid.arch.suse.de (adalid.arch.suse.de [10.161.8.13]) by relay2.suse.de (Postfix) with ESMTP id 77FC8A3BB2; Tue, 17 Aug 2021 09:16:42 +0000 (UTC) Received: by adalid.arch.suse.de (Postfix, from userid 16045) id 7594D518CEA3; Tue, 17 Aug 2021 11:16:42 +0200 (CEST) From: Hannes Reinecke To: "Martin K. Petersen" Cc: Christoph Hellwig , James Bottomley , linux-scsi@vger.kernel.org, Hannes Reinecke , Hannes Reinecke Subject: [PATCH 34/51] scsi_transport_iscsi: use session as argument for iscsi_block_scsi_eh() Date: Tue, 17 Aug 2021 11:14:39 +0200 Message-Id: <20210817091456.73342-35-hare@suse.de> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210817091456.73342-1-hare@suse.de> References: <20210817091456.73342-1-hare@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org We should be passing in the session directly instead of deriving it from the scsi command. Signed-off-by: Hannes Reinecke --- drivers/scsi/qla4xxx/ql4_os.c | 34 ++++++++++++++++++----------- drivers/scsi/scsi_transport_iscsi.c | 6 ++--- include/scsi/scsi_transport_iscsi.h | 2 +- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index f4b046867627..130bc0c58c2e 100644 --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c @@ -9262,15 +9262,18 @@ static int qla4xxx_eh_abort(struct scsi_cmnd *cmd) **/ static int qla4xxx_eh_device_reset(struct scsi_cmnd *cmd) { - struct scsi_qla_host *ha = to_qla_host(cmd->device->host); - struct ddb_entry *ddb_entry = cmd->device->hostdata; + struct scsi_device *sdev = cmd->device; + struct scsi_qla_host *ha = to_qla_host(sdev->host); + struct iscsi_cls_session *session; + struct ddb_entry *ddb_entry = sdev->hostdata; int ret = FAILED, stat; int rval; if (!ddb_entry) return ret; - ret = iscsi_block_scsi_eh(cmd); + session = starget_to_session(scsi_target(sdev)); + ret = iscsi_block_scsi_eh(session); if (ret) return ret; ret = FAILED; @@ -9331,19 +9334,25 @@ static int qla4xxx_eh_device_reset(struct scsi_cmnd *cmd) **/ static int qla4xxx_eh_target_reset(struct scsi_cmnd *cmd) { - struct scsi_qla_host *ha = to_qla_host(cmd->device->host); - struct ddb_entry *ddb_entry = cmd->device->hostdata; + struct scsi_target *starget = scsi_target(cmd->device); + struct iscsi_cls_session *cls_session = starget_to_session(starget); + struct iscsi_session *sess; + struct scsi_qla_host *ha; + struct ddb_entry *ddb_entry; int stat, ret; int rval; + sess = cls_session->dd_data; + ddb_entry = sess->dd_data; if (!ddb_entry) return FAILED; + ha = ddb_entry->ha; - ret = iscsi_block_scsi_eh(cmd); + ret = iscsi_block_scsi_eh(cls_session); if (ret) return ret; - starget_printk(KERN_INFO, scsi_target(cmd->device), + starget_printk(KERN_INFO, starget, "WARM TARGET RESET ISSUED.\n"); DEBUG2(printk(KERN_INFO @@ -9360,14 +9369,13 @@ static int qla4xxx_eh_target_reset(struct scsi_cmnd *cmd) stat = qla4xxx_reset_target(ha, ddb_entry); if (stat != QLA_SUCCESS) { - starget_printk(KERN_INFO, scsi_target(cmd->device), + starget_printk(KERN_INFO, starget, "WARM TARGET RESET FAILED.\n"); return FAILED; } - if (qla4xxx_eh_wait_for_commands(ha, scsi_target(cmd->device), - NULL)) { - starget_printk(KERN_INFO, scsi_target(cmd->device), + if (qla4xxx_eh_wait_for_commands(ha, starget, NULL)) { + starget_printk(KERN_INFO, starget, "WARM TARGET DEVICE RESET FAILED - " "waiting for commands.\n"); return FAILED; @@ -9376,13 +9384,13 @@ static int qla4xxx_eh_target_reset(struct scsi_cmnd *cmd) /* Send marker. */ if (qla4xxx_send_marker_iocb(ha, ddb_entry, cmd->device->lun, MM_TGT_WARM_RESET) != QLA_SUCCESS) { - starget_printk(KERN_INFO, scsi_target(cmd->device), + starget_printk(KERN_INFO, starget, "WARM TARGET DEVICE RESET FAILED - " "marker iocb failed.\n"); return FAILED; } - starget_printk(KERN_INFO, scsi_target(cmd->device), + starget_printk(KERN_INFO, starget, "WARM TARGET RESET SUCCEEDED.\n"); return SUCCESS; } diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index b07105ae7c91..7eac4a003541 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -1868,17 +1868,15 @@ static void iscsi_scan_session(struct work_struct *work) /** * iscsi_block_scsi_eh - block scsi eh until session state has transistioned - * @cmd: scsi cmd passed to scsi eh handler + * @session: iscsi session derived from scsi eh handler argument * * If the session is down this function will wait for the recovery * timer to fire or for the session to be logged back in. If the * recovery timer fires then FAST_IO_FAIL is returned. The caller * should pass this error value to the scsi eh. */ -int iscsi_block_scsi_eh(struct scsi_cmnd *cmd) +int iscsi_block_scsi_eh(struct iscsi_cls_session *session) { - struct iscsi_cls_session *session = - starget_to_session(scsi_target(cmd->device)); unsigned long flags; int ret = 0; diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h index c5d7810fd792..50d714c05440 100644 --- a/include/scsi/scsi_transport_iscsi.h +++ b/include/scsi/scsi_transport_iscsi.h @@ -453,7 +453,7 @@ extern struct iscsi_endpoint *iscsi_create_endpoint(int dd_size); extern void iscsi_destroy_endpoint(struct iscsi_endpoint *ep); extern struct iscsi_endpoint *iscsi_lookup_endpoint(u64 handle); extern void iscsi_put_endpoint(struct iscsi_endpoint *ep); -extern int iscsi_block_scsi_eh(struct scsi_cmnd *cmd); +extern int iscsi_block_scsi_eh(struct iscsi_cls_session *session); extern struct iscsi_iface *iscsi_create_iface(struct Scsi_Host *shost, struct iscsi_transport *t, uint32_t iface_type,