From patchwork Mon Apr 29 18:00:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 2500801 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 E9E4A40134 for ; Mon, 29 Apr 2013 18:01:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758565Ab3D2SBD (ORCPT ); Mon, 29 Apr 2013 14:01:03 -0400 Received: from mail-qa0-f42.google.com ([209.85.216.42]:64748 "EHLO mail-qa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758590Ab3D2SBC (ORCPT ); Mon, 29 Apr 2013 14:01:02 -0400 Received: by mail-qa0-f42.google.com with SMTP id dx4so1162269qab.8 for ; Mon, 29 Apr 2013 11:01:01 -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=jwmv5WUNG3w3JrPdbV5TME3Wo+Rgrgz5bXRejWyP83c=; b=AIxXF3QOO/IK+7PlbWJnepmV8Dopq/79/YJFs/AOa07F2xnyaUyy1CrJn310ykhwuX 6y7xO/MiTSNUTV2bHhBeC48+MDISTN6rerlmcHBoYDrP+79vO9/rJt3lDjCZWU1iQ1dx DSKGVtRc6UPB474tswkdggirp3AfipkPv1nWI2PcKWfsXgNXnwKwP1yTSEVzzNER9zsk QcRXh/uWLFgxi68yiGg9YSRTTc3KEexwoP3s6S2Gwm5waatb2BTLe6vKmwXCyWN9prPK c29PwEFNPoRl2UqUhtG7dgQYZcU3MpufQgmjAD8YWYVeQVpOAy18/tSpPrkUnk5dpy3N 4OYw== X-Received: by 10.49.82.4 with SMTP id e4mr62505651qey.62.1367258461000; Mon, 29 Apr 2013 11:01:01 -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 j9sm26808564qas.3.2013.04.29.11.00.59 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 29 Apr 2013 11:01:00 -0700 (PDT) Message-ID: <517EB55B.7060709@inktank.com> Date: Mon, 29 Apr 2013 13:00:59 -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 4/5] rbd: don't have device release destroy rbd_dev References: <517EB4F0.1070607@inktank.com> In-Reply-To: <517EB4F0.1070607@inktank.com> X-Gm-Message-State: ALoCoQl5aHPFOlIJ1fDANj6cOFEWbsY3imiidAOHE958jPs/aOvdru8llLq0AdBCA864JOG5pSnc Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org Currently an rbd_device structure gets destroyed from the release routine for the device embedded within it. Stop doing that, instead calling rbd_dev_image_release() right after rbd_bus_del_dev() wherever the latter is called. Signed-off-by: Alex Elder --- drivers/block/rbd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) @@ -5079,6 +5078,7 @@ static ssize_t rbd_remove(struct bus_type *bus, goto done; ret = count; rbd_bus_del_dev(rbd_dev); + rbd_dev_image_release(rbd_dev); module_put(THIS_MODULE); done: mutex_unlock(&ctl_mutex); diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 595d7b3..ff850e9 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -5013,8 +5013,6 @@ static void rbd_dev_device_release(struct device *dev) rbd_dev->major = 0; rbd_dev_id_put(rbd_dev); rbd_dev_mapping_clear(rbd_dev); - - rbd_dev_image_release(rbd_dev); } static void rbd_dev_remove_parent(struct rbd_device *rbd_dev) @@ -5034,6 +5032,7 @@ static void rbd_dev_remove_parent(struct rbd_device *rbd_dev) } rbd_assert(second); rbd_bus_del_dev(second); + rbd_dev_image_release(second); first->parent = NULL; first->parent_overlap = 0;