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: 9224477 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 8940C604DB for ; Tue, 12 Jul 2016 00:38:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7A2A127F17 for ; Tue, 12 Jul 2016 00:38:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6E86727F8D; Tue, 12 Jul 2016 00:38:51 +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 0272B27F17 for ; Tue, 12 Jul 2016 00:38:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932383AbcGLAif (ORCPT ); Mon, 11 Jul 2016 20:38:35 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:38588 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932088AbcGLAie (ORCPT ); Mon, 11 Jul 2016 20:38:34 -0400 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: , , , , , , , , Subject: [PATCH v2] xen_pvscsi: reclaim the ring request when the prepairing failed 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 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org 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);