Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3525687pxf; Mon, 15 Mar 2021 11:30:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzz70ZpgXgEoAx6kjnaF79W/Y7Inpojq/zvATQ8c2eZoPE7VW4ng5GO89XcMPYll/vLrmtF X-Received: by 2002:a17:906:4055:: with SMTP id y21mr20130368ejj.507.1615833023164; Mon, 15 Mar 2021 11:30:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615833023; cv=none; d=google.com; s=arc-20160816; b=HpdxQIVZbHeHPf1SzxnhEXXirZHLgPQDXJ+87rQbSmhq26+EOjrXRgodVOsCDuM/6j PeUt4OP41+2ntpu9ziVW9my2NRNuQ5cnqTqQd9ZG5X3bCDOE/d1IsscUawp56Y/Hlg7u D1tPrJJx7QJg1fwOIDS9R/L446zcubaKjuKGeP8j1n3pEQKzHKRtUte+p0Y24jzvPJi4 iy3PfxiJnoYdZ4N+WX+pf2WbtZcdmub9yYmSyhkG3KXVzv79OFpoZ5ZpxX6LpK+gty9P Qgiv0QmttJ1Z9AVHJPPlkjvA9Z68dWTRmW9P9DTKtGEVZRCO2PoO1EXgyB23yYYChdrc 7PQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xpJ2cO15oymTbVFvq/wBBigUuknkGpvuK7lrbtO9b40=; b=tz2X5nhxNh1HQNh/S74MOwjIMJNQWlHKYMX21A3W4THLyC3ggf5U1Iz+/wTDPDFH8T /lkTNOH3FfAi7M/JTmKl9DXXYii5FeiL1/a2JjQj9W81yx3LocUWqxS8RRCYSDbGh4Mq CGVQSeeHTG+qVkrfiUsXlPhVoTcditITcU7RSZpDrhHTRLBXeTMxNbMRufR6lpJE+4tc nwJA3tdfKtk0dh6QYNMla0++YaQX0nty33K0RLBLwvHraFkW11ESrgIB/ehSnh5dp89l Pq+twX38IK7SwzC/uQ/Cf9KcHV+kQ0BAjzNH9IhkHE9vcUIs09lPaUV2KDIDnN0NPUZE /VGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZZPDpX58; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y40si12743616ede.204.2021.03.15.11.30.00; Mon, 15 Mar 2021 11:30:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZZPDpX58; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237264AbhCOOgv (ORCPT + 99 others); Mon, 15 Mar 2021 10:36:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:38284 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233413AbhCOOBj (ORCPT ); Mon, 15 Mar 2021 10:01:39 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3E34964EEE; Mon, 15 Mar 2021 14:01:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816875; bh=lGXlLu9M+yApqFb0BvhtkK55OOdETpiMLO5JZ8sZkPU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZZPDpX583eyIplwwemkBTHOEDUZPwM4+Tl9HuXrV4rULhmVLMauogeQxBpXAaenvF hSsuKrEiH6S9l/v8FlNbYekz+v/FuSMtMuyY3ogh6azj2l99VhZngEaYid3yEc8phA 2aYrEA4FYyIPR/xhvtSajVET92I/2EN8xBGS/LNM= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lee Duncan , Mike Christie , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.10 163/290] scsi: libiscsi: Fix iscsi_prep_scsi_cmd_pdu() error handling Date: Mon, 15 Mar 2021 14:54:16 +0100 Message-Id: <20210315135547.413286263@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135541.921894249@linuxfoundation.org> References: <20210315135541.921894249@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Greg Kroah-Hartman From: Mike Christie [ Upstream commit d28d48c699779973ab9a3bd0e5acfa112bd4fdef ] If iscsi_prep_scsi_cmd_pdu() fails we try to add it back to the cmdqueue, but we leave it partially setup. We don't have functions that can undo the pdu and init task setup. We only have cleanup_task which can clean up both parts. So this has us just fail the cmd and go through the standard cleanup routine and then have the SCSI midlayer retry it like is done when it fails in the queuecommand path. Link: https://lore.kernel.org/r/20210207044608.27585-2-michael.christie@oracle.com Reviewed-by: Lee Duncan Signed-off-by: Mike Christie Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/libiscsi.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 5125a6c7f70e..41b8192d207d 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -1532,14 +1532,9 @@ static int iscsi_data_xmit(struct iscsi_conn *conn) } rc = iscsi_prep_scsi_cmd_pdu(conn->task); if (rc) { - if (rc == -ENOMEM || rc == -EACCES) { - spin_lock_bh(&conn->taskqueuelock); - list_add_tail(&conn->task->running, - &conn->cmdqueue); - conn->task = NULL; - spin_unlock_bh(&conn->taskqueuelock); - goto done; - } else + if (rc == -ENOMEM || rc == -EACCES) + fail_scsi_task(conn->task, DID_IMM_RETRY); + else fail_scsi_task(conn->task, DID_ABORT); spin_lock_bh(&conn->taskqueuelock); continue; -- 2.30.1