From patchwork Wed Jan 25 23:36:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 9538119 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 781206042C for ; Wed, 25 Jan 2017 23:37:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6D0D027F17 for ; Wed, 25 Jan 2017 23:37:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6088A27FBC; Wed, 25 Jan 2017 23:37:11 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 0342E27F17 for ; Wed, 25 Jan 2017 23:37:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752088AbdAYXhJ (ORCPT ); Wed, 25 Jan 2017 18:37:09 -0500 Received: from mail-cys01nam02on0066.outbound.protection.outlook.com ([104.47.37.66]:2406 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751427AbdAYXg6 (ORCPT ); Wed, 25 Jan 2017 18:36:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sandiskcorp.onmicrosoft.com; s=selector1-sandisk-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=EAocJ3mrang50NZNOR45Dduiuyjf/tT4VFvcirD+zQY=; b=DUTt2RaTjMv0B+XGQmvQREc6NtpjllanEd1bd4OMSMNbmKRhtiOw1HbGLxKdyOe8mbsW4XjFKTx9l+d1S4bqkUEf9KhAXJMBfpopBr5xRs30mzunE+JutE1BnW6IKmrQHiUZnZ7Ttw8kUctrsy59IZsH9pwY8LWKFZjd6A9wobc= Received: from CY1PR0201CA0014.namprd02.prod.outlook.com (10.163.30.152) by BLUPR02MB034.namprd02.prod.outlook.com (10.242.191.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.860.13; Wed, 25 Jan 2017 23:36:56 +0000 Received: from BN1AFFO11FD042.protection.gbl (2a01:111:f400:7c10::172) by CY1PR0201CA0014.outlook.office365.com (2a01:111:e400:58b9::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.860.13 via Frontend Transport; Wed, 25 Jan 2017 23:36:55 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.21) smtp.mailfrom=sandisk.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=sandisk.com; Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 63.163.107.21 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.21; helo=milsmgep15.sandisk.com; Received: from milsmgep15.sandisk.com (63.163.107.21) by BN1AFFO11FD042.mail.protection.outlook.com (10.58.52.253) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.803.8 via Frontend Transport; Wed, 25 Jan 2017 23:36:54 +0000 Received: from MILHUBIP03.sdcorp.global.sandisk.com (Unknown_Domain [10.201.67.162]) (using TLS with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by (Symantec Messaging Gateway) with SMTP id 4A.C8.65426.6C339885; Wed, 25 Jan 2017 15:24:54 -0800 (PST) Received: from milsmgip11.sandisk.com (10.177.8.100) by MILHUBIP03.sdcorp.global.sandisk.com (10.177.9.96) with Microsoft SMTP Server id 14.3.319.2; Wed, 25 Jan 2017 15:36:49 -0800 X-AuditID: 0ac94369-b62949800001ff92-2c-588933c685e5 Received: from exp-402881.sdcorp.global.sandisk.com ( [10.177.9.6]) by (Symantec Messaging Gateway) with SMTP id 4C.35.16817.19639885; Wed, 25 Jan 2017 15:36:49 -0800 (PST) From: Bart Van Assche To: Bart Van Assche CC: , Christoph Hellwig , "Andy Grover" , David Disseldorp Subject: [PATCH 17/34] target: Make ABORT and LUN RESET handling synchronous Date: Wed, 25 Jan 2017 15:36:29 -0800 Message-ID: <20170125233646.2243-18-bart.vanassche@sandisk.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170125233646.2243-1-bart.vanassche@sandisk.com> References: <20170125233646.2243-1-bart.vanassche@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrOLMWRmVeSWpSXmKPExsXCddJ5ke4x484Igw9nBSz2z3rGZPH1/3QW i5WrjzJZtC59y+TA4rH7ZgObx/t9V9k8Np+u9vi8SS6AJYrLJiU1J7MstUjfLoEro+HoA5aC Z22MFSsn72duYPye18XIySEhYCLRufk6excjF4eQwFImibt3WhlBEkICOxglZvw1gimad+cW C0TRRkaJg3tvsoMk2ASMJL69n8kCYosIGEj87r3ACFLELNDBKDG/5xkrSEJYwEfiwelPYFNZ BFQlHuw7wAZi8wrYS3x7eZsdYoO8xK62i2D1nEDx1rM/WSCusJNYf6CVCWSohEAXq8S2zX3s EM2CEidnPgErYhaQkDj44gUzRIO6xMkl85kmMArNQlI2C0nZAkamVYxiuZk5xbnpqQWGpnrF iXkpmcXZesn5uZsYIcGduYPx7hPvQ4wCHIxKPLwCWzoihFgTy4orcw8xSnAwK4nwrpPrjBDi TUmsrEotyo8vKs1JLT7EKM3BoiTO63bvS5iQQHpiSWp2ampBahFMlomDU6qBkedH0sno9Wof f5+rtmk2/nvRqMd55Yf88+clHQvWWQnf6LE3z2y0VCySaymQnjT5+eTMByG9x9Tn5rEviP1l srR9m/u16VKefl9lv4UJPetLmOOw8sq2/N+THm+7/floW/6cnXtb71aXmeXsYsjZfeXuPru4 i3e/LYo++4cjYFqXpflD3TWKH5RYijMSDbWYi4oTARFrdChqAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrOJMWRmVeSWpSXmKPExsXCtZGTTXeiWWeEwfTrxhb7Zz1jsjj4s43R 4uv/6SwWK1cfZbJoXfqWyYHVY/fNBjaP9/uusnlMW3OeyWPz6WqPz5vkAlijuGxSUnMyy1KL 9O0SuDIajj5gKXjWxlixcvJ+5gbG73ldjJwcEgImEvPu3GLpYuTiEBJYzyjxbdd9JpAEm4CR xLf3M1lAbBEBA4nfvRcYQYqYBboYJTadOcUOkhAW8JF4cPoTI4jNIqAq8WDfATYQm1fAXuLm omnsEBvkJXa1XWQFsTmB4q1nf4INFRKwk1h/oJVpAiP3AkaGVYxiuZk5xbnpmQWGhnrFiXkp mcXZesn5uZsYIUERuYPx6UTzQ4xMHJxSDYxnTzAssTp3pYa3LVVp9fRC1yPtC/+x7uBLkJpa deqI4LUJj/bPPjxl7/wdMTcm5bmkzee98pqtY/OE3q//U5bK/bCx5K8P/ZD75FLNrOpPlt4b g3s55GdNfvzd697MFSZrDY53nhf+ynvU5sS5u3lML8MiPTQiv3289DpQ9ACzVuvdGfmnWD8w KLEUZyQaajEXFScCANjVkWu6AQAA MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:63.163.107.21; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(39410400002)(39850400002)(39840400002)(39450400003)(39860400002)(2980300002)(438002)(199003)(189002)(68736007)(92566002)(81156014)(110136003)(50466002)(50986999)(8936002)(1076002)(81166006)(7049001)(47776003)(2950100002)(38730400001)(97736004)(48376002)(6862003)(50226002)(1691005)(6666003)(2906002)(36756003)(5003940100001)(189998001)(76176999)(53936002)(6200100001)(33646002)(106466001)(69596002)(4326007)(626004)(356003)(54906002)(86362001)(5660300001)(77096006)(575784001)(2270400002)(8676002)(305945005)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR02MB034; H:milsmgep15.sandisk.com; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD042; 1:dzcREBNBf07XKl6/Xyy0nrXtlwvhsp6ognk9rbt4x9nrolgo1A6Kl+V04mRQU1+wyjkUsTm0+BLS8ICsjWH18kE699w2nLFxaSuhnC5YkxkEAeyPl3ZWMfdEcUO867cRgM75wnBN0kn+Mco/gYhtuqTCt3UTKEdbIcN/eseTW/UGCd3Tx+E5dsYkfwXhu0U056vLGbkPjU3XVNpl04EqHC/N9L4AHFBxNCx4qBTwrotFau5/pkorMwgTjn/BltsHF3tGiH8v8oAA4IeroZNgDpvOSCogV41DVi9doIPnGl2HeznI2IghAEUUJvrkFryGr12NrA1bVA0gxJ7D/eZd5G4TfJfp8n1MXS39nNOs72t4nCig3ljIZP9MC9U5pDafUqazQbF3V0dmXsH1Z6YOWYMyu+Bh3mPIjTBRCH7Rp9Oy54Eop0GV9GOFowHGHwvNORi6nks3GpQHCymnNygywn0haUqVRuT2R+rF2jW6vnGJ0ZD6RTxOHonvvorXl43q X-MS-Office365-Filtering-Correlation-Id: 99d7c37b-2c84-4c98-bb92-08d4457b0c28 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002); SRVR:BLUPR02MB034; X-Microsoft-Exchange-Diagnostics: 1; BLUPR02MB034; 3:wP3siPmV7gofMxWf9YWkILevnYoF9N6FFV0BzPG9Jlkml71NPaRJjDnmQasCU3Vi9kf7sw0cCvizEoS5MK0VfWROieo0bN71Dwcsp/Hf+zI4yUtuhqS7EzaV0ikksN3AZSSjNHKAxSTU3K3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4K7U3uJ0mQF7m44dAUizkRVIBepXPJjRXE0DfXlOcBdhamTw9B+vS82r1N7BnQff7U8Gj2jVpz4pxUcbDdd6Ne+6Nr6kY42Di0Zp7c7rYcoBbiXzBO/sUZK1sIWD6saplll1iUOsL0JZC7icljji+0+atdHRKoP4ERe87brkQkJhVKo6u2JcW0NT09jvgYPdBsfDBRrMi2iG/RYvJam3HYX1Kv/Qpd2PdlmD45/t4HJDzNMdcdkfA/ccrn9vNJ+86tU03c9PlGyINbqUkNlPg9NsRY2fKbEbhSepDo1NLyBPsisVWueBzBmMvW1T0/wygwugKB19cJvIIDrjFznxiuorhDzN4HHYAJSUmj+oJcG/mYBTwZwT/w/d8dvXlIy1o2mA+m4g39FWbfG9l6n5RF+oVClAwgsG/cEOkkDoaTJ+5nu0mdosT7zT4Pq1ZRgt8KR1b4C57tvKOo4PG8SlJlvlizYUkox2hyj4LP9XK X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(158342451672863)(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(13016025)(13018025)(8121501046)(5005006)(3002001)(10201501046)(6055026)(6041248)(20161123555025)(20161123562025)(20161123564025)(20161123560025)(20161123558021)(6072148); SRVR:BLUPR02MB034; BCL:0; PCL:0; RULEID:; SRVR:BLUPR02MB034; X-Microsoft-Exchange-Diagnostics: 1; BLUPR02MB034; 4:8jNp/LLpYpyOmNlZ456Sg3iKiX+hL2vxUoUpIFLjqNRU5NwGekkztGz4VZZ1oSbD67+V8d8DqIxcRLZzcya17Bxmz3X95yfLa0FsPrSi4v21guzoPeKwcfkUFbzROXox8/4dVTezkMg6zS4pIzH+OKnzDpXGYzVVm2FMrDosrqFDh5MCH7JaMHhO0F5prw3qXxi74JmniPttmYwQnbLZZ/mSwCmkPgjHZ7ahg5kALOAzJJs3FELMyARKxQ+cKFUjDZcGf7uGowZwg4j3kiV+bXcxREkI2sHKtTTWQuwWd6IPbA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1tthED6PsbPxNTzWnz5dCzV53yq5mJEiKv+H2bYL9a4iaf+qEawpmb64S/jXhS+j0Rh5zqm44Di4VvWlY0r4PLB8WaJ55ML4zRqu1EOJhiQi/cSwHe+JpRgY91/mmNAJKW7FYAd2g5fG1R+l1yv+HL4H15+z5gajWp6qHhvcOKvi/0vKSXxzy1LInBWlDw150JpODGNyE9nUyUw== X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2017 23:36:54.8068 (UTC) X-MS-Exchange-CrossTenant-Id: fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d; Ip=[63.163.107.21]; Helo=[milsmgep15.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR02MB034 Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of invoking target driver callback functions from the context that handles an abort or LUN RESET task management function, only set the abort flag from that context and perform the actual abort handling from the context of the regular command processing flow. This approach has the following advantages: - The task management function code becomes much easier to read and to verify since the number of potential race conditions against the command processing flow is strongly reduced. - It is no longer needed to store the command state into the command itself since that information is no longer needed from the context where a task management function is processed. Notes: - With this patch applied the CMD_T_ABORTED flag is checked at two points by the target core: just before local execution of a command starts (see also target_execute_cmd()) and also just before the response is sent (see also target_complete_cmd()). - Two .release_cmd() calls have been changed into transport_put_cmd() calls to ensure that the 'finished' completion is set before .release_cmd() is called. Signed-off-by: Bart Van Assche Cc: Christoph Hellwig Cc: Andy Grover Cc: David Disseldorp --- drivers/target/target_core_internal.h | 2 - drivers/target/target_core_tmr.c | 73 ++++++++-------- drivers/target/target_core_transport.c | 153 +++++++++++++-------------------- include/target/target_core_base.h | 2 + 4 files changed, 95 insertions(+), 135 deletions(-) diff --git a/drivers/target/target_core_internal.h b/drivers/target/target_core_internal.h index 9ab7090f7c83..6f6cae81ab8e 100644 --- a/drivers/target/target_core_internal.h +++ b/drivers/target/target_core_internal.h @@ -136,7 +136,6 @@ int init_se_kmem_caches(void); void release_se_kmem_caches(void); u32 scsi_get_new_index(scsi_index_t); void transport_subsystem_check_init(void); -void transport_cmd_finish_abort(struct se_cmd *, int); unsigned char *transport_dump_cmd_direction(struct se_cmd *); void transport_dump_dev_state(struct se_device *, char *, int *); void transport_dump_dev_info(struct se_device *, struct se_lun *, @@ -146,7 +145,6 @@ int transport_dump_vpd_assoc(struct t10_vpd *, unsigned char *, int); int transport_dump_vpd_ident_type(struct t10_vpd *, unsigned char *, int); int transport_dump_vpd_ident(struct t10_vpd *, unsigned char *, int); void transport_clear_lun_ref(struct se_lun *); -void transport_send_task_abort(struct se_cmd *); sense_reason_t target_cmd_size_check(struct se_cmd *cmd, unsigned int size); void target_qf_do_work(struct work_struct *work); bool target_check_wce(struct se_device *dev); diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c index 367799b4dde1..bc07e059fb22 100644 --- a/drivers/target/target_core_tmr.c +++ b/drivers/target/target_core_tmr.c @@ -75,25 +75,6 @@ void core_tmr_release_req(struct se_tmr_req *tmr) kfree(tmr); } -static void core_tmr_handle_tas_abort(struct se_cmd *cmd, int tas) -{ - unsigned long flags; - bool remove = true, send_tas; - /* - * TASK ABORTED status (TAS) bit support - */ - spin_lock_irqsave(&cmd->t_state_lock, flags); - send_tas = (cmd->transport_state & CMD_T_TAS); - spin_unlock_irqrestore(&cmd->t_state_lock, flags); - - if (send_tas) { - remove = false; - transport_send_task_abort(cmd); - } - - transport_cmd_finish_abort(cmd, remove); -} - static int target_check_cdb_and_preempt(struct list_head *list, struct se_cmd *cmd) { @@ -192,13 +173,13 @@ void core_tmr_abort_task( continue; } - list_del_init(&se_cmd->se_cmd_list); + se_cmd->send_abort_response = false; spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); - cancel_work_sync(&se_cmd->work); - transport_wait_for_tasks(se_cmd); + while (!wait_for_completion_timeout(&se_cmd->finished, 180 * HZ)) + pr_debug("ABORT TASK: still waiting for ITT %#llx\n", + ref_tag); - transport_cmd_finish_abort(se_cmd, true); target_put_sess_cmd(se_cmd); printk("ABORT_TASK: Sending TMR_FUNCTION_COMPLETE for" @@ -295,14 +276,31 @@ static void core_tmr_drain_tmr_list( (preempt_and_abort_list) ? "Preempt" : "", tmr_p, tmr_p->function, tmr_p->response, cmd->t_state); - cancel_work_sync(&cmd->work); - transport_wait_for_tasks(cmd); - - transport_cmd_finish_abort(cmd, 1); + while (!wait_for_completion_timeout(&cmd->finished, 180 * HZ)) + pr_debug("LUN RESET: still waiting for ITT %#llx\n", + cmd->tag); target_put_sess_cmd(cmd); } } +/** + * core_tmr_drain_state_list() - Abort SCSI commands associated with a device. + * + * @dev: Device for which to abort outstanding SCSI commands. + * @prout_cmd: Pointer to the SCSI PREEMPT AND ABORT if this function is called + * to realize the PREEMPT AND ABORT functionality. + * @tmr_sess: Session through which the LUN RESET has been received. + * @tas: Task Aborted Status (TAS) bit from the SCSI control mode page. + * A quote from SPC-4, paragraph "7.5.10 Control mode page": + * "A task aborted status (TAS) bit set to zero specifies that + * aborted commands shall be terminated by the device server + * without any response to the application client. A TAS bit set + * to one specifies that commands aborted by the actions of an I_T + * nexus other than the I_T nexus on which the command was + * received shall be completed with TASK ABORTED status." + * @preempt_and_abort_list: For the PREEMPT AND ABORT functionality, a list + * with registrations that will be preempted. + */ static void core_tmr_drain_state_list( struct se_device *dev, struct se_cmd *prout_cmd, @@ -311,6 +309,7 @@ static void core_tmr_drain_state_list( struct list_head *preempt_and_abort_list) { LIST_HEAD(drain_task_list); + struct se_node_acl *tmr_nacl = tmr_sess ? tmr_sess->se_node_acl : NULL; struct se_session *sess; struct se_cmd *cmd, *next; unsigned long flags; @@ -340,6 +339,10 @@ static void core_tmr_drain_state_list( */ spin_lock_irqsave(&dev->execute_task_lock, flags); list_for_each_entry_safe(cmd, next, &dev->state_list, state_list) { + /* Skip task management functions. */ + if (cmd->se_cmd_flags & SCF_SCSI_TMR_CDB) + continue; + /* * For PREEMPT_AND_ABORT usage, only process commands * with a matching reservation key. @@ -365,6 +368,8 @@ static void core_tmr_drain_state_list( list_move_tail(&cmd->state_list, &drain_task_list); cmd->state_active = false; + if (tmr_nacl && tmr_nacl != cmd->se_sess->se_node_acl && tas) + cmd->send_abort_response = true; } spin_unlock_irqrestore(&dev->execute_task_lock, flags); @@ -387,17 +392,9 @@ static void core_tmr_drain_state_list( (cmd->transport_state & CMD_T_STOP) != 0, (cmd->transport_state & CMD_T_SENT) != 0); - /* - * If the command may be queued onto a workqueue cancel it now. - * - * This is equivalent to removal from the execute queue in the - * loop above, but we do it down here given that - * cancel_work_sync may block. - */ - cancel_work_sync(&cmd->work); - transport_wait_for_tasks(cmd); - - core_tmr_handle_tas_abort(cmd, tas); + while (!wait_for_completion_timeout(&cmd->finished, 180 * HZ)) + pr_debug("LUN RESET: still waiting for cmd with ITT %#llx\n", + cmd->tag); target_put_sess_cmd(cmd); } } diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 5821ac0c349d..d37c759daa89 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -636,25 +636,6 @@ static void transport_lun_remove_cmd(struct se_cmd *cmd) percpu_ref_put(&lun->lun_ref); } -void transport_cmd_finish_abort(struct se_cmd *cmd, int remove) -{ - bool ack_kref = (cmd->se_cmd_flags & SCF_ACK_KREF); - - if (cmd->se_cmd_flags & SCF_SE_LUN_CMD) - transport_lun_remove_cmd(cmd); - /* - * Allow the fabric driver to unmap any resources before - * releasing the descriptor via TFO->release_cmd() - */ - if (remove) - cmd->se_tfo->aborted_task(cmd); - - if (transport_cmd_check_stop_to_fabric(cmd)) - return; - if (remove && ack_kref) - transport_put_cmd(cmd); -} - static void target_complete_failure_work(struct work_struct *work) { struct se_cmd *cmd = container_of(work, struct se_cmd, work); @@ -686,14 +667,58 @@ static unsigned char *transport_get_sense_buffer(struct se_cmd *cmd) return cmd->sense_buffer; } +static void transport_handle_abort(struct se_cmd *cmd) +{ + bool ack_kref = cmd->se_cmd_flags & SCF_ACK_KREF; + + transport_lun_remove_cmd(cmd); + + if (cmd->send_abort_response) { + cmd->scsi_status = SAM_STAT_TASK_ABORTED; + pr_debug("Setting SAM_STAT_TASK_ABORTED status for CDB: 0x%02x, ITT: 0x%08llx\n", + cmd->t_task_cdb[0], cmd->tag); + trace_target_cmd_complete(cmd); + cmd->se_tfo->queue_status(cmd); + transport_cmd_check_stop_to_fabric(cmd); + } else { + /* + * Allow the fabric driver to unmap any resources before + * releasing the descriptor via TFO->release_cmd() + */ + cmd->se_tfo->aborted_task(cmd); + /* + * To do: establish a unit attention condition on the I_T + * nexus associated with cmd. See also the paragraph "Aborting + * commands" in SAM. + */ + if (transport_cmd_check_stop_to_fabric(cmd) == 0 && ack_kref) + transport_put_cmd(cmd); + } +} + +static void target_abort_work(struct work_struct *work) +{ + struct se_cmd *cmd = container_of(work, struct se_cmd, work); + + transport_handle_abort(cmd); +} + +/* May be called from interrupt context so must not sleep. */ void target_complete_cmd(struct se_cmd *cmd, u8 scsi_status) { struct se_device *dev = cmd->se_dev; int success = scsi_status == GOOD; unsigned long flags; - cmd->scsi_status = scsi_status; + if (cmd->transport_state & CMD_T_ABORTED) { + INIT_WORK(&cmd->work, target_abort_work); + goto queue_work; + } else if (cmd->transport_state & CMD_T_STOP) { + complete_all(&cmd->t_transport_stop_comp); + return; + } + cmd->scsi_status = scsi_status; spin_lock_irqsave(&cmd->t_state_lock, flags); cmd->transport_state &= ~CMD_T_BUSY; @@ -706,16 +731,7 @@ void target_complete_cmd(struct se_cmd *cmd, u8 scsi_status) success = 1; } - /* - * Check for case where an explicit ABORT_TASK has been received - * and transport_wait_for_tasks() will be waiting for completion.. - */ - if (cmd->transport_state & CMD_T_ABORTED || - cmd->transport_state & CMD_T_STOP) { - spin_unlock_irqrestore(&cmd->t_state_lock, flags); - complete_all(&cmd->t_transport_stop_comp); - return; - } else if (!success) { + if (!success) { INIT_WORK(&cmd->work, target_complete_failure_work); } else { INIT_WORK(&cmd->work, target_complete_ok_work); @@ -725,6 +741,7 @@ void target_complete_cmd(struct se_cmd *cmd, u8 scsi_status) cmd->transport_state |= (CMD_T_COMPLETE | CMD_T_ACTIVE); spin_unlock_irqrestore(&cmd->t_state_lock, flags); +queue_work: if (cmd->se_cmd_flags & SCF_USE_CPUID) queue_work_on(cmd->cpuid, target_completion_wq, &cmd->work); else @@ -1207,6 +1224,7 @@ void transport_init_se_cmd( INIT_LIST_HEAD(&cmd->state_list); init_completion(&cmd->t_transport_stop_comp); init_completion(&cmd->cmd_wait_comp); + init_completion(&cmd->finished); spin_lock_init(&cmd->t_state_lock); kref_init(&cmd->cmd_kref); cmd->transport_state = CMD_T_DEV_ACTIVE; @@ -1869,16 +1887,18 @@ static int __transport_check_aborted_status(struct se_cmd *, int); void target_execute_cmd(struct se_cmd *cmd) { /* + * If the received CDB has aleady been aborted stop processing it here. + */ + if (transport_check_aborted_status(cmd, 1) != 0) + return; + + /* * Determine if frontend context caller is requesting the stopping of * this command for frontend exceptions. * * If the received CDB has aleady been aborted stop processing it here. */ spin_lock_irq(&cmd->t_state_lock); - if (__transport_check_aborted_status(cmd, 1)) { - spin_unlock_irq(&cmd->t_state_lock); - return; - } if (cmd->transport_state & CMD_T_STOP) { pr_debug("%s:%d CMD_T_STOP for ITT: 0x%08llx\n", __func__, __LINE__, cmd->tag); @@ -2485,15 +2505,11 @@ static void target_wait_free_cmd(struct se_cmd *cmd, bool *aborted, bool *tas) int transport_generic_free_cmd(struct se_cmd *cmd, int wait_for_tasks) { - int ret = 0; bool aborted = false, tas = false; if (!(cmd->se_cmd_flags & SCF_SE_LUN_CMD)) { if (wait_for_tasks && (cmd->se_cmd_flags & SCF_SCSI_TMR_CDB)) target_wait_free_cmd(cmd, &aborted, &tas); - - if (!aborted || tas) - ret = transport_put_cmd(cmd); } else { if (wait_for_tasks) target_wait_free_cmd(cmd, &aborted, &tas); @@ -2507,9 +2523,6 @@ int transport_generic_free_cmd(struct se_cmd *cmd, int wait_for_tasks) if (cmd->se_lun) transport_lun_remove_cmd(cmd); - - if (!aborted || tas) - ret = transport_put_cmd(cmd); } /* * If the task has been internally aborted due to TMR ABORT_TASK @@ -2520,10 +2533,8 @@ int transport_generic_free_cmd(struct se_cmd *cmd, int wait_for_tasks) if (aborted) { pr_debug("Detected CMD_T_ABORTED for ITT: %llu\n", cmd->tag); wait_for_completion(&cmd->cmd_wait_comp); - cmd->se_tfo->release_cmd(cmd); - ret = 1; } - return ret; + return transport_put_cmd(cmd); } EXPORT_SYMBOL(transport_generic_free_cmd); @@ -2582,6 +2593,8 @@ static void target_release_cmd_kref(struct kref *kref) unsigned long flags; bool fabric_stop; + complete_all(&se_cmd->finished); + spin_lock_irqsave(&se_sess->sess_cmd_lock, flags); spin_lock(&se_cmd->t_state_lock); @@ -2683,7 +2696,7 @@ void target_wait_for_sess_cmds(struct se_session *se_sess) " fabric state: %d\n", se_cmd, se_cmd->t_state, se_cmd->se_tfo->get_cmd_state(se_cmd)); - se_cmd->se_tfo->release_cmd(se_cmd); + target_put_sess_cmd(se_cmd); } spin_lock_irqsave(&se_sess->sess_cmd_lock, flags); @@ -2995,16 +3008,7 @@ static int __transport_check_aborted_status(struct se_cmd *cmd, int send_status) return 1; } - pr_debug("Sending delayed SAM_STAT_TASK_ABORTED status for CDB:" - " 0x%02x ITT: 0x%08llx\n", cmd->t_task_cdb[0], cmd->tag); - cmd->se_cmd_flags &= ~SCF_SEND_DELAYED_TAS; - cmd->scsi_status = SAM_STAT_TASK_ABORTED; - trace_target_cmd_complete(cmd); - - spin_unlock_irq(&cmd->t_state_lock); - cmd->se_tfo->queue_status(cmd); - spin_lock_irq(&cmd->t_state_lock); return 1; } @@ -3021,47 +3025,6 @@ int transport_check_aborted_status(struct se_cmd *cmd, int send_status) } EXPORT_SYMBOL(transport_check_aborted_status); -void transport_send_task_abort(struct se_cmd *cmd) -{ - unsigned long flags; - - spin_lock_irqsave(&cmd->t_state_lock, flags); - if (cmd->se_cmd_flags & (SCF_SENT_CHECK_CONDITION)) { - spin_unlock_irqrestore(&cmd->t_state_lock, flags); - return; - } - spin_unlock_irqrestore(&cmd->t_state_lock, flags); - - /* - * If there are still expected incoming fabric WRITEs, we wait - * until until they have completed before sending a TASK_ABORTED - * response. This response with TASK_ABORTED status will be - * queued back to fabric module by transport_check_aborted_status(). - */ - if (cmd->data_direction == DMA_TO_DEVICE) { - if (cmd->se_tfo->write_pending_status(cmd) != 0) { - spin_lock_irqsave(&cmd->t_state_lock, flags); - if (cmd->se_cmd_flags & SCF_SEND_DELAYED_TAS) { - spin_unlock_irqrestore(&cmd->t_state_lock, flags); - goto send_abort; - } - cmd->se_cmd_flags |= SCF_SEND_DELAYED_TAS; - spin_unlock_irqrestore(&cmd->t_state_lock, flags); - return; - } - } -send_abort: - cmd->scsi_status = SAM_STAT_TASK_ABORTED; - - transport_lun_remove_cmd(cmd); - - pr_debug("Setting SAM_STAT_TASK_ABORTED status for CDB: 0x%02x, ITT: 0x%08llx\n", - cmd->t_task_cdb[0], cmd->tag); - - trace_target_cmd_complete(cmd); - cmd->se_tfo->queue_status(cmd); -} - static void target_tmr_work(struct work_struct *work) { struct se_cmd *cmd = container_of(work, struct se_cmd, work); diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index b953ad635929..b837561294d8 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -443,6 +443,7 @@ struct se_cmd { unsigned cmd_wait_set:1; unsigned unknown_data_length:1; bool state_active:1; + bool send_abort_response:1; u64 tag; /* SAM command identifier aka task tag */ /* Delay for ALUA Active/NonOptimized state access in milliseconds */ int alua_nonop_delay; @@ -495,6 +496,7 @@ struct se_cmd { spinlock_t t_state_lock; struct kref cmd_kref; struct completion t_transport_stop_comp; + struct completion finished; struct work_struct work;