From patchwork Wed Apr 17 21:44:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10906245 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7CEBB1390 for ; Wed, 17 Apr 2019 21:45:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6809C28A93 for ; Wed, 17 Apr 2019 21:45:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5C5AE28BA9; Wed, 17 Apr 2019 21:45:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0A88A28A93 for ; Wed, 17 Apr 2019 21:45:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387942AbfDQVpZ (ORCPT ); Wed, 17 Apr 2019 17:45:25 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:38220 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387936AbfDQVpU (ORCPT ); Wed, 17 Apr 2019 17:45:20 -0400 Received: by mail-pf1-f196.google.com with SMTP id 10so81926pfo.5 for ; Wed, 17 Apr 2019 14:45:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RUXS3QJeHlU6u83GrujViMiZrlRAsTS9n7kot8UwBoQ=; b=FjA62bWlp9Q/XM2CewMHBRtm5SLaqIKvfonkmT1ebvaikUsP0ZrGkjTwX+aXfzfoud ltxzEVpHpKUUJpUhnp3rvIrDmZTfm9u+KY1kWc/qgxTzFGzr0m6DY3ddo6dVVAtCZvOK URmZyLOwSWe/sRuGkpso8XevhVQOKHA1JtMZlUVuFRygGdY/bXqxQobVUHtrKwvjfy8W B8u5BlBwXObY5a0F38WI5tzyFdqXDw4PtA0lxQbLgB7dnnvURXU9KLhPZjlfr0Th7HIQ OWZ02/Gmr8b6AbAl5HwAhcfmKYTA3NxfU8BJxytA2mrxk909yZxgwzZhapshsVoPnp3E TAiw== X-Gm-Message-State: APjAAAUdCb3/+pgTgwweMGvn3oKaPx99rBTJUpCGM5AnrPCZYLEGFijy /uQWUcQomzJ0J05iip6dmWc= X-Google-Smtp-Source: APXvYqx1rDnEea1x/VKzDJjd8Wn0FrRtO+9cNSk759nG06b9GeSXbSD5YqiC+q4NbyrCDd3L3N1nVw== X-Received: by 2002:a62:6ec6:: with SMTP id j189mr10505103pfc.195.1555537520091; Wed, 17 Apr 2019 14:45:20 -0700 (PDT) Received: from desktop-bart.svl.corp.google.com ([2620:15c:2cd:203:5cdc:422c:7b28:ebb5]) by smtp.gmail.com with ESMTPSA id d68sm219314pfg.16.2019.04.17.14.45.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Apr 2019 14:45:19 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Himanshu Madhani , Giridhar Malavali Subject: [PATCH 21/34] qla2xxx: Complain if a command is released that is owned by the firmware Date: Wed, 17 Apr 2019 14:44:30 -0700 Message-Id: <20190417214443.243152-22-bvanassche@acm.org> X-Mailer: git-send-email 2.20.GIT In-Reply-To: <20190417214443.243152-1-bvanassche@acm.org> References: <20190417214443.243152-1-bvanassche@acm.org> MIME-Version: 1.0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The previous patch guarantees that a command is only released after the firmware has finished processing it. Hence complain if a command is released that is owned by the firmware. Cc: Himanshu Madhani Cc: Giridhar Malavali Signed-off-by: Bart Van Assche --- drivers/scsi/qla2xxx/tcm_qla2xxx.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c index 38eaee6be127..4fcae1af2d63 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c @@ -321,7 +321,6 @@ static int tcm_qla2xxx_check_stop_free(struct se_cmd *se_cmd) static void tcm_qla2xxx_release_cmd(struct se_cmd *se_cmd) { struct qla_tgt_cmd *cmd; - unsigned long flags; if (se_cmd->se_cmd_flags & SCF_SCSI_TMR_CDB) { struct qla_tgt_mgmt_cmd *mcmd = container_of(se_cmd, @@ -331,14 +330,10 @@ static void tcm_qla2xxx_release_cmd(struct se_cmd *se_cmd) } cmd = container_of(se_cmd, struct qla_tgt_cmd, se_cmd); - spin_lock_irqsave(&cmd->cmd_lock, flags); - if (cmd->cmd_sent_to_fw) { - cmd->released = 1; - spin_unlock_irqrestore(&cmd->cmd_lock, flags); - } else { - spin_unlock_irqrestore(&cmd->cmd_lock, flags); - qlt_free_cmd(cmd); - } + if (WARN_ON(cmd->cmd_sent_to_fw)) + return; + + qlt_free_cmd(cmd); } static void tcm_qla2xxx_release_session(struct kref *kref)