From patchwork Fri Apr 26 18:00:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 2494621 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id A96B13FC64 for ; Fri, 26 Apr 2013 18:00:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756519Ab3DZSAv (ORCPT ); Fri, 26 Apr 2013 14:00:51 -0400 Received: from mail-ie0-f182.google.com ([209.85.223.182]:36703 "EHLO mail-ie0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755834Ab3DZSAu (ORCPT ); Fri, 26 Apr 2013 14:00:50 -0400 Received: by mail-ie0-f182.google.com with SMTP id bn7so5258247ieb.13 for ; Fri, 26 Apr 2013 11:00:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=2Nbxfo0v4t3KoASnQRAONZqWshnMSy5bTyzgmU/ClLE=; b=A2yo/d4qz7bTYDZaIdkSsoedi4H0GHy8Ant8X++zkd6EzKGx2s6fHSh/Nlr680/zHv BvesID/pFIt3f2WvElEBiFauYilAXv+9KILo5kKUE5ZcxjTM7+GCYXJJ1eE+cV9D3+ix AEFoH65xh3WlSBFlQTQi5d8hM4haAJInIXrPd25KHijQwgNEzTjVviuTvh2mYOTe8F9y aW9ibRg1v8f4VLtecVewCHVX2ndfXdHvlKwDllaKT3T3SjWN47wg8HzkdTRdUp/OHyA4 9DcdUZ2zW8qXFdv7XWFYGhB5G/zZ0nRKVmqeFnikRGo/A1/wtX+l8Ht5Jq3O9cryCLuu R3kw== X-Received: by 10.50.108.17 with SMTP id hg17mr2547150igb.57.1366999250142; Fri, 26 Apr 2013 11:00:50 -0700 (PDT) Received: from [172.22.22.4] (c-71-195-31-37.hsd1.mn.comcast.net. [71.195.31.37]) by mx.google.com with ESMTPSA id in10sm4404248igc.1.2013.04.26.11.00.48 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 26 Apr 2013 11:00:49 -0700 (PDT) Message-ID: <517AC0D0.30708@inktank.com> Date: Fri, 26 Apr 2013 13:00:48 -0500 From: Alex Elder User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: ceph-devel@vger.kernel.org Subject: [PATCH 5/7] rbd: make rbd_dev_destroy() match rbd_dev_create() References: <517AC047.6060000@inktank.com> In-Reply-To: <517AC047.6060000@inktank.com> X-Gm-Message-State: ALoCoQnwUs9C6fLuQez5F5hXvzGybVpku3NyIaHBhUsUM+ZjGp9b+AHbT3xJHLy3eZOVzhOAC+Cs Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org Currently, rbd_dev_destroy() does more than just the inverse of what rbd_dev_create() does. Stop doing that, and move the two extra things it does into the three call sites. Signed-off-by: Alex Elder Reviewed-by: Josh Durgin --- drivers/block/rbd.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) kfree(rbd_dev); @@ -4784,6 +4782,8 @@ static int rbd_dev_probe_finish(struct rbd_device *rbd_dev) return ret; err_out_parent: + rbd_spec_put(rbd_dev->parent_spec); + kfree(rbd_dev->header_name); rbd_dev_destroy(parent); err_out_spec: rbd_spec_put(parent_spec); @@ -4905,6 +4905,8 @@ static ssize_t rbd_add(struct bus_type *bus, return count; err_out_rbd_dev: + rbd_spec_put(rbd_dev->parent_spec); + kfree(rbd_dev->header_name); rbd_dev_destroy(rbd_dev); err_out_client: rbd_put_client(rbdc); @@ -4955,6 +4957,8 @@ static void rbd_dev_release(struct device *dev) /* done with the id, and with the rbd_dev */ rbd_dev_id_put(rbd_dev); rbd_assert(rbd_dev->rbd_client != NULL); + rbd_spec_put(rbd_dev->parent_spec); + kfree(rbd_dev->header_name); rbd_dev_destroy(rbd_dev); /* release module ref */ diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 63040fd..0356bba 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -3425,8 +3425,6 @@ static struct rbd_device *rbd_dev_create(struct rbd_client *rbdc, static void rbd_dev_destroy(struct rbd_device *rbd_dev) { - rbd_spec_put(rbd_dev->parent_spec); - kfree(rbd_dev->header_name); rbd_put_client(rbd_dev->rbd_client); rbd_spec_put(rbd_dev->spec);