From patchwork Wed Feb 8 22:24:36 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: 9563635 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 9AC356020F for ; Wed, 8 Feb 2017 22:27:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F04A2840B for ; Wed, 8 Feb 2017 22:27:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 627D22852B; Wed, 8 Feb 2017 22:27:35 +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.9 required=2.0 tests=BAYES_00,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 15AC62840B for ; Wed, 8 Feb 2017 22:27:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751301AbdBHW1e (ORCPT ); Wed, 8 Feb 2017 17:27:34 -0500 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:63863 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751443AbdBHW1a (ORCPT ); Wed, 8 Feb 2017 17:27:30 -0500 X-IronPort-AV: E=Sophos;i="5.35,348,1483977600"; d="scan'208";a="76618163" Received: from unknown (HELO milsmgep14.sandisk.com) ([63.163.107.225]) by ob1.hgst.iphmx.com with ESMTP; 09 Feb 2017 06:28:20 +0800 Received: from MILHUBIP04.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 C4.72.18895.ACA9B985; Wed, 8 Feb 2017 14:25:14 -0800 (PST) Received: from milsmgip12.sandisk.com (10.177.8.100) by MILHUBIP04.sdcorp.global.sandisk.com (10.177.9.97) with Microsoft SMTP Server id 14.3.319.2; Wed, 8 Feb 2017 14:25:11 -0800 X-AuditID: 0ac94371-0fadb980000049cf-f6-589b9acaa28b Received: from exp-402881.sdcorp.global.sandisk.com ( [10.177.9.6]) by (Symantec Messaging Gateway) with SMTP id 6F.32.18148.7CA9B985; Wed, 8 Feb 2017 14:25:11 -0800 (PST) From: Bart Van Assche To: Bart Van Assche CC: , Himanshu Madhani , Giridhar Malavali Subject: [PATCH v4 06/37] target: Make core_tmr_abort_task() consider all commands Date: Wed, 8 Feb 2017 14:24:36 -0800 Message-ID: <20170208222507.25715-7-bart.vanassche@sandisk.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170208222507.25715-1-bart.vanassche@sandisk.com> References: <20170208222507.25715-1-bart.vanassche@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrBLMWRmVeSWpSXmKPExsXCddJ5ke6pWbMjDO791LLY8+Acm8WFPd2M Fq1L3zI5MHvM+L2IxePzJrkApigum5TUnMyy1CJ9uwSujP41m9gKDvNUdE5awNbAeI2ri5GT Q0LARGLi1X7mLkYuDiGBpUwSXxf8YYdwtjNKrHy4mQmm6unLQywQiY2MEvuOLGQESbAJGEl8 ez+TBcQWETCQ+N17ASzOLNDBKDHjayyILSwQJPH70XNWEJtFQEXi+qyPYDW8AvYSH9ZMY4NY IC+xq+0iWA2ngIPEhJfPwGqEgGpeHfjCCLJYQuA1i8Tj/SuhmgUlTs58wgKxTELi4IsXzBAN 6hInl8xnmsAoNAtJ2SwkZQsYmVYxiuVm5hTnpqcWGJroFSfmpWQWZ+sl5+duYoSEb+EOxte3 vQ8xCnAwKvHwXrCeHSHEmlhWXJl7iFGCg1lJhDdlGlCINyWxsiq1KD++qDQntfgQozQHi5I4 b5bs1AghgfTEktTs1NSC1CKYLBMHp1QDo89S6xXrZqXLM1tzNH9uqH14OtxlmW9gnaZCQ8b5 OxkXTszO4cyKT2m5079M9kjrZWWbRYfin6eoTjI3PLLnaOW2I467tgt8st5XXF1nzR7A8nLu HoOpz76XHVR0ibnUnmzf/OVH6v1tStaMWZ8WW7eL7JMMs7U4Jf24ytgmRLf/IsflZyaySizF GYmGWsxFxYkAskBLWlsCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprGJMWRmVeSWpSXmKPExsXCtZGTTff4rNkRBn8ui1gc/NnGaLHnwTk2 iwt7uhktWpe+ZXJg8ZjxexGLx7Q155k8Pm+SC2CO4rJJSc3JLEst0rdL4MroX7OJreAwT0Xn pAVsDYzXuLoYOTkkBEwknr48xAJiCwmsZ5RonRoEYrMJGEl8ez8TLC4iYCDxu/cCYxcjFwez QBujxPntj8ESwgJBEr8fPWcFsVkEVCV2/Z3J3sXIwcErYC8xaZ0AxHx5iV1tF8FKOAUcJCa8 fMYIscte4tWBL4wTGLkXMDKsYhTLzcwpzk3PLDA00itOzEvJLM7WS87P3cQI8XnUDsbrE80P MTJxcEo1MAa/NqibrnNW/FG4w6XQ6szwU5Kmb7aJn67/MHHidZ0nwi3pDov3Neyd2y95U+yp 9H/VZ8W7vjcs9L+wvG6m/Zb9fD8jPLktt8S9s/iVedX6tWrRSuWUsC1M65en7StXm3X4U2rr rPxOpqJarydhfbvcxHTSX/DNOGoYpX2Sw8nrg7nZr/qzz5RYijMSDbWYi4oTAXCIBnmpAQAA MIME-Version: 1.0 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 It is possible that two commands with the same tag are present on sess_cmd_list because commands are removed from sess_cmd_list after a response has been sent to the initiator. Hence continue searching through sess_cmd_list even if a matching tag has already been found. Signed-off-by: Bart Van Assche Reviewed-by: Hannes Reinecke Reviewed-by: Christoph Hellwig Cc: Himanshu Madhani Cc: Giridhar Malavali --- drivers/target/target_core_tmr.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c index 4f229e711e1c..311dc3c2f1dc 100644 --- a/drivers/target/target_core_tmr.c +++ b/drivers/target/target_core_tmr.c @@ -175,10 +175,9 @@ void core_tmr_abort_task( printk("ABORT_TASK: Found referenced %s task_tag: %llu\n", se_cmd->se_tfo->get_fabric_name(), ref_tag); - if (!__target_check_io_state(se_cmd, se_sess, 0)) { - spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); - goto out; - } + if (!__target_check_io_state(se_cmd, se_sess, 0)) + continue; + list_del_init(&se_cmd->se_cmd_list); spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); @@ -195,7 +194,6 @@ void core_tmr_abort_task( } spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); -out: printk("ABORT_TASK: Sending TMR_TASK_DOES_NOT_EXIST for ref_tag: %lld\n", tmr->ref_task_tag); tmr->response = TMR_TASK_DOES_NOT_EXIST;