Received: by 10.223.164.202 with SMTP id h10csp1047971wrb; Tue, 7 Nov 2017 20:36:42 -0800 (PST) X-Google-Smtp-Source: ABhQp+TpYKY0FqIO9y0HvMHkVUk7Az2m04pZHytbNEdAw84DUVgzdeK9rodT3jumg5Dg+ufSfkez X-Received: by 10.84.129.98 with SMTP id 89mr994108plb.379.1510115802790; Tue, 07 Nov 2017 20:36:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510115802; cv=none; d=google.com; s=arc-20160816; b=P6R5s2SaZVXCNafaF4CeuD0qam01aKovkYgPSDUCetVg+yc0YYhNa6n09uygOYlOH3 qvrhFIoCtfA1b9XhNRMK6OCkGkt4fnj9YyRsCy1+35x6aFnIzNAaYlkI9SmrbaiXUIUe I595MnROvnJaIM9PfrTz/tHO4qCmHq+c/thdOIijUSB3L3NXOqA+eBrvn1siI5EgsfRh iI7SvrLydBPwjaAx4xT47nltmhxJwWcIEEctJ3X1mWiHun12CYVqCR224kD8SEG0pz40 33wkngKgblM05SSNxO3i4pyqryTJ/BAVRlDxzPQsMIRMS3xT7G3rqvhUuamrsFUOTUbS aVpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=5inJvLyQfA+aVdskjtO1L1cU0bGbbNMWLNNFh504CXc=; b=WWSBdHewXMuDMTClFTxw9X21sqY0GDfIQsDVsTPVJABu6XYuHS60pOqLTWgfCjwhuX Aj0sLOZFaP7EwmXaztc+sttiGzmEx6DuBR8IsRwuet6QrSzudWZRcWz/uXr08Jo+WCn6 Jdg/hcTRszRswkUXAoJD0m/6X97fVUEYDVEZu5qyycGM1//9dhJBawMuF7pfdJCRAVN0 O9Abqzcg6794MLea/SMVmLA8fVDyHJAai+sTN0aIjqQeZ99D0VHQmzSI2AmkGQcGZAqr s7IovYAoOH3u4YPND2ZcX3ZSMS6C/eqVQ2dcCAlxqT2TSNiEFLtF028LrZFis0RvBvHi TTfw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id be11si2586937plb.605.2017.11.07.20.36.30; Tue, 07 Nov 2017 20:36:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752431AbdKHEbO (ORCPT + 91 others); Tue, 7 Nov 2017 23:31:14 -0500 Received: from mail.linux-iscsi.org ([67.23.28.174]:60307 "EHLO linux-iscsi.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752183AbdKHEbK (ORCPT ); Tue, 7 Nov 2017 23:31:10 -0500 Received: from linux-iscsi.org (localhost [127.0.0.1]) by linux-iscsi.org (Postfix) with ESMTP id F2F8E40005; Wed, 8 Nov 2017 04:31:56 +0000 (UTC) From: "Nicholas A. Bellinger" To: target-devel Cc: linux-scsi , lkml , Nicholas Bellinger , Michael Cyr , "Bryant G. Ly" , Mike Christie , Hannes Reinecke Subject: [PATCH 1/6] target: Fix QUEUE_FULL + SCSI task attribute handling Date: Wed, 8 Nov 2017 04:31:47 +0000 Message-Id: <1510115512-15617-2-git-send-email-nab@linux-iscsi.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1510115512-15617-1-git-send-email-nab@linux-iscsi.org> References: <1510115512-15617-1-git-send-email-nab@linux-iscsi.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nicholas Bellinger This patch fixes a bug during QUEUE_FULL where transport_complete_qf() calls transport_complete_task_attr() after it's already been invoked by target_complete_ok_work() or transport_generic_request_failure() during initial completion, preceeding QUEUE_FULL. This will result in se_device->simple_cmds, se_device->dev_cur_ordered_id and/or se_device->dev_ordered_sync being updated multiple times for a single se_cmd. To address this bug, clear SCF_TASK_ATTR_SET after the first call to transport_complete_task_attr(), and avoid updating SCSI task attribute related counters for any subsequent calls. Also, when a se_cmd is deferred due to ordered tags and executed via target_restart_delayed_cmds(), set CMD_T_SENT before execution matching what target_execute_cmd() does. Cc: Michael Cyr Cc: Bryant G. Ly Cc: Mike Christie Cc: Hannes Reinecke Signed-off-by: Nicholas Bellinger --- drivers/target/target_core_transport.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 473d652..c33d1e9 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -2011,6 +2011,8 @@ static void target_restart_delayed_cmds(struct se_device *dev) list_del(&cmd->se_delayed_node); spin_unlock(&dev->delayed_cmd_lock); + cmd->transport_state |= CMD_T_SENT; + __target_execute_cmd(cmd, true); if (cmd->sam_task_attr == TCM_ORDERED_TAG) @@ -2046,6 +2048,8 @@ static void transport_complete_task_attr(struct se_cmd *cmd) pr_debug("Incremented dev_cur_ordered_id: %u for ORDERED\n", dev->dev_cur_ordered_id); } + cmd->se_cmd_flags &= ~SCF_TASK_ATTR_SET; + restart: target_restart_delayed_cmds(dev); } -- 1.9.1 From 1583546286691791908@xxx Thu Nov 09 00:30:22 +0000 2017 X-GM-THRID: 1583546286691791908 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread