Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3520128pxf; Mon, 15 Mar 2021 11:22:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxTFVGtPlXAhaCr8XD02j318sL6rFbXYGL0XU8B/nulDga+ropO9VdxhW1mqzqj86BEs2UK X-Received: by 2002:a17:907:7249:: with SMTP id ds9mr25651212ejc.9.1615832551995; Mon, 15 Mar 2021 11:22:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615832551; cv=none; d=google.com; s=arc-20160816; b=p7lLVJVgMh/8oMZxAH7B+gTpCrQiDD9TA5yGjz1DybpKDkDyij1agNH7qfUgEvKjMO z5KLWmEICU0/rLH740afsILJW2QsMGzrkfGI2vpWkCSBncudNLNWPBFIjrtBhcFaxTCg rY+Eb8v0wPUnDWCAKCe79nedhktPtveAYt3Hs1St9mg9v54BFnhPsksoDVDjmXbaJo1i 69qV96RlgbB+ZAhDrT5P0LDUsnCKGVPxOkhuzI8BZIsVswMOnG+C4bppS5ovUnBpfXmS d4V0oJox5USWAM4T4ES0vC8uSrz4pxpnA1YrZ2sh7Gm4IsnrEJoIWxS3G2KshUEIx+Pc +cdA== 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=aUxmMIeP3nZPHR9Gw0Pw/627NoPsRANmUhDi8x+aGjc=; b=BukGM9JGOnUx+uMzn1qiPV8EdXL0Y7lcT9bQNEcw5WAsLBjI8DFhoCGR8gkstw4+p/ 0rOSudGLpfFfBcGS/jXocN0Jmi9eLvP+7ByRxtKTgTr0807ppLPCcEmCYfzWKiktMcYD bbJQnKln34jWU475awtinNqLAMHpIZt06sCVvOFqDKOy6Yn/IA+xWxb9S+OmqjF1pzTl 9KZqyfisQv41gxQdgl4HRgtv1RbBCYoEejgCl7AZV8s16jN2qjnuodJ/vjItOTe/Pejs +O8EinzvTwkgDnqmRD2czAdflCLX9rjiA1X3cxDMBU8gLxv4eIysP3/8uEb0Cc77hXDg wu3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tHkiMwjD; 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 v15si12496490ede.1.2021.03.15.11.22.10; Mon, 15 Mar 2021 11:22:31 -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=tHkiMwjD; 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 S237641AbhCOOTW (ORCPT + 99 others); Mon, 15 Mar 2021 10:19:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:37500 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232446AbhCON7v (ORCPT ); Mon, 15 Mar 2021 09:59:51 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0F80764EEE; Mon, 15 Mar 2021 13:59:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816770; bh=bBN+CPspmMuksUYtrracu+FpsI3QkIuvzYT1qHxWRuQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tHkiMwjDE3uZVglLfe/0DL9KKVDF7f+2LPgRfuJmJiOFFNP7tfduiUDKKbZscHfYJ PtrB+1BkUUh5SmbdWFOwwaY/67y/GYrioY/3NvZnoSaz2dURv5M1o5ujc6ViXprUk9 RSWjam3WPBsWomQpSFtvVxEuIBkqO0zPWnXjWqio= 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 4.19 056/120] scsi: libiscsi: Fix iscsi_prep_scsi_cmd_pdu() error handling Date: Mon, 15 Mar 2021 14:56:47 +0100 Message-Id: <20210315135721.825139153@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135720.002213995@linuxfoundation.org> References: <20210315135720.002213995@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 2e40fd78e7b3..81471c304991 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -1569,14 +1569,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