From patchwork Tue Jul 12 00:36:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Wu X-Patchwork-Id: 9224479 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 A6799604DB for ; Tue, 12 Jul 2016 00:41:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 978BD27F17 for ; Tue, 12 Jul 2016 00:41:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A51D27F8D; Tue, 12 Jul 2016 00:41:23 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 18F0727F17 for ; Tue, 12 Jul 2016 00:41:22 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bMlio-0004xZ-Vd; Tue, 12 Jul 2016 00:38:46 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bMlin-0004xR-MC for xen-devel@lists.xenproject.org; Tue, 12 Jul 2016 00:38:45 +0000 Received: from [85.158.137.68] by server-4.bemta-3.messagelabs.com id AA/B5-18304-41C34875; Tue, 12 Jul 2016 00:38:44 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnkeJIrShJLcpLzFFi42Kx+j3DQVfYpiX c4ON5NYvvWyYzOTB6HP5whSWAMYo1My8pvyKBNeP+n0mMBcs4Kr4e/8DewDiTvYuRi0NI4BSj xJZ9vcxdjJxAzhJGiY8X9EBsNgElib2rbzGB2CIC05gkuv6yg9jCAsESM9ZfBLI5OFgEVCVe3 lIECfMKOEv8/jONESQsIaAlcWulBURYUOLkzCcsIDazgITEwRcvmCFKFCSOL7QDCUsISEocXH GDBeQaCZBrfm3pZYFImEosebWVcQIj3ywko2YhGbWAkWkVo3pxalFZapGukV5SUWZ6RkluYma OrqGBsV5uanFxYnpqTmJSsV5yfu4mRmBA1TMwMO5gPNXsfIhRkoNJSZS3mbklXIgvKT+lMiOx OCO+qDQntfgQowwHh5IE7y4roJxgUWp6akVaZg4wtGHSEhw8SiK8S0HSvMUFibnFmekQqVOMi lLivJtBEgIgiYzSPLg2WDxdYpSVEuZlZGBgEOIpSC3KzSxBlX/FKM7BqCTMWwoyhSczrwRu+i ugxUxAi2sdmkEWlyQipKQaGHf8qFX4EvX1vd27jW/nKdgpTN6VPu973MbnyqsdIzrW2vvmqbj c/G6l/uzA61/vX052vJ8/8+A25Yh/8sXfvUQ2d7nMeeSU5ySnrrKa4dyMpvvrH2pq7jdO3aC6 oE/qTsOl6a+jNoa1b/C6dWl/RG569MsffqoTV+pY3796pmXLnkpRBRvG+weVWIozEg21mIuKE wFzypOiogIAAA== X-Env-Sender: wu.wubin@huawei.com X-Msg-Ref: server-16.tower-31.messagelabs.com!1468283916!42385754!1 X-Originating-IP: [58.251.152.64] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.46; banners=-,-,- X-VirusChecked: Checked Received: (qmail 15346 invoked from network); 12 Jul 2016 00:38:42 -0000 Received: from szxga01-in.huawei.com (HELO szxga01-in.huawei.com) (58.251.152.64) by server-16.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 12 Jul 2016 00:38:42 -0000 Received: from 172.24.1.60 (EHLO szxeml422-hub.china.huawei.com) ([172.24.1.60]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DNN29683; Tue, 12 Jul 2016 08:38:20 +0800 (CST) Received: from localhost (10.177.24.77) by szxeml422-hub.china.huawei.com (10.82.67.152) with Microsoft SMTP Server id 14.3.235.1; Tue, 12 Jul 2016 08:38:10 +0800 From: Bin Wu To: , , , , , , , , Date: Tue, 12 Jul 2016 08:36:27 +0800 Message-ID: <1468283787-18260-1-git-send-email-wu.wubin@huawei.com> X-Mailer: git-send-email 1.7.3.1.msysgit.0 MIME-Version: 1.0 X-Originating-IP: [10.177.24.77] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090201.57843BFE.0062, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 2b07d8f992b5267163975ef582779efe Subject: [Xen-devel] [PATCH v2] xen_pvscsi: reclaim the ring request when the prepairing failed X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP During scsi command queueing or exception handling, if prepairing fails, we need to reclaim the failed request. Otherwise, the garbage request will be pushed into the ring for the backend to work. Signed-off-by: Bin Wu Reviewed-by: Juergen Gross --- drivers/scsi/xen-scsifront.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/xen-scsifront.c b/drivers/scsi/xen-scsifront.c index 9dc8687..8646db1 100644 --- a/drivers/scsi/xen-scsifront.c +++ b/drivers/scsi/xen-scsifront.c @@ -184,8 +184,6 @@ static struct vscsiif_request *scsifront_pre_req(struct vscsifrnt_info *info) ring_req = RING_GET_REQUEST(&(info->ring), ring->req_prod_pvt); - ring->req_prod_pvt++; - ring_req->rqid = (uint16_t)id; return ring_req; @@ -196,6 +194,8 @@ static void scsifront_do_request(struct vscsifrnt_info *info) struct vscsiif_front_ring *ring = &(info->ring); int notify; + ring->req_prod_pvt++; + RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(ring, notify); if (notify) notify_remote_via_irq(info->irq);