From patchwork Mon Sep 26 07:36:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bob Liu X-Patchwork-Id: 9350239 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 6F0C5607D6 for ; Mon, 26 Sep 2016 07:38:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6384628B13 for ; Mon, 26 Sep 2016 07:38:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 57EDF28B33; Mon, 26 Sep 2016 07:38:58 +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, UNPARSEABLE_RELAY 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 D483F28B13 for ; Mon, 26 Sep 2016 07:38:57 +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 1boQTC-0007Oo-P6; Mon, 26 Sep 2016 07:36:58 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1boQTA-0007Oc-QZ for xen-devel@lists.xenproject.org; Mon, 26 Sep 2016 07:36:56 +0000 Received: from [85.158.139.211] by server-6.bemta-5.messagelabs.com id 99/89-06971-810D8E75; Mon, 26 Sep 2016 07:36:56 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrELMWRWlGSWpSXmKPExsXSO6nOVVf0wot wg65Xahbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8bBE82sBYs4K+a+WsvWwPiPvYuRi0NIoI1J YvO/HawQzjdGiV+nH7FBOBsZJa7PvgTl9DJKPJl1hamLkYODTUBJYv799C5GTg4RIPPeqslMI DazQInE0+NvWEFKhAW8JVrWBoKEWQRUJU7/2A5WwivgJHFjwmtWEFtCQFGi+9kENgjbUOL0w2 2MExh5FjAyrGJUL04tKkst0rXUSyrKTM8oyU3MzNE1NDDVy00tLk5MT81JTCrWS87P3cQI9Ds DEOxgXNvqfIhRkoNJSZSXZfWLcCG+pPyUyozE4oz4otKc1OJDjDIcHEoSvA/OAeUEi1LTUyvS MnOAAQiTluDgURLh1QFJ8xYXJOYWZ6ZDpE4xKkqJ8y4GSQiAJDJK8+DaYEF/iVFWSpiXEegQI Z6C1KLczBJU+VeM4hyMSsK88ueBpvBk5pXATX8FtJgJaPHSE2CLSxIRUlINjJrT7u7gOcAcke erGrNO/PVO/5ivjxJOr8kvyWS0ZMm/xmXm/0l8i5dVfUfG89CwfV4JD0sMmSY5y9UJOgpWWf9 c8C5tSeTyXfvso+rTNevVJsWdObyHw31qfkrXmT28dko5jzueM6puOHvitVVQVtaqz36z9r+v ZPGd/v96gJDqX92Fa//kKrEUZyQaajEXFScCAB+EB7Z1AgAA X-Env-Sender: bob.liu@oracle.com X-Msg-Ref: server-13.tower-206.messagelabs.com!1474875410!45807607!1 X-Originating-IP: [141.146.126.69] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTQxLjE0Ni4xMjYuNjkgPT4gMjc3MjE4\n X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 53021 invoked from network); 26 Sep 2016 07:36:52 -0000 Received: from aserp1040.oracle.com (HELO aserp1040.oracle.com) (141.146.126.69) by server-13.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 26 Sep 2016 07:36:52 -0000 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u8Q7amND029082 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 26 Sep 2016 07:36:48 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0021.oracle.com (8.13.8/8.13.8) with ESMTP id u8Q7alX2015334 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 26 Sep 2016 07:36:47 GMT Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id u8Q7ak8O006312; Mon, 26 Sep 2016 07:36:47 GMT Received: from boliuliu.jp.oracle.com (/10.191.5.204) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 26 Sep 2016 00:36:46 -0700 From: Bob Liu To: xen-devel@lists.xenproject.org Date: Mon, 26 Sep 2016 15:36:24 +0800 Message-Id: <1474875384-24671-1-git-send-email-bob.liu@oracle.com> X-Mailer: git-send-email 1.7.10.4 X-Source-IP: userv0021.oracle.com [156.151.31.71] Cc: Bob Liu , linux-kernel@vger.kernel.org, roger.pau@citrix.com Subject: [Xen-devel] [PATCH] block: xen-blkback: don't get/put blkif ref for each queue 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: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP xen_blkif_get/put() for each queue is useless, and introduces a bug: If there is I/O inflight when removing device, xen_blkif_disconnect() will return -EBUSY and xen_blkif_put() not be called. Which means the references are leaked, then even if I/O completed, the xen_blkif_put() won't call xen_blkif_deferred_free() to free resources anymore. Signed-off-by: Bob Liu Reviewed-by: Konrad Rzeszutek Wilk --- drivers/block/xen-blkback/xenbus.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c index 3cc6d1d..2e1bb6d 100644 --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c @@ -159,7 +159,6 @@ static int xen_blkif_alloc_rings(struct xen_blkif *blkif) init_waitqueue_head(&ring->shutdown_wq); ring->blkif = blkif; ring->st_print = jiffies; - xen_blkif_get(blkif); } return 0; @@ -296,7 +295,6 @@ static int xen_blkif_disconnect(struct xen_blkif *blkif) BUG_ON(ring->free_pages_num != 0); BUG_ON(ring->persistent_gnt_c != 0); WARN_ON(i != (XEN_BLKIF_REQS_PER_PAGE * blkif->nr_ring_pages)); - xen_blkif_put(blkif); } blkif->nr_ring_pages = 0; /*