From patchwork Mon Apr 29 18:01:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 2500811 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 7B2603FD85 for ; Mon, 29 Apr 2013 18:01:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758598Ab3D2SBO (ORCPT ); Mon, 29 Apr 2013 14:01:14 -0400 Received: from mail-qe0-f43.google.com ([209.85.128.43]:37336 "EHLO mail-qe0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758327Ab3D2SBN (ORCPT ); Mon, 29 Apr 2013 14:01:13 -0400 Received: by mail-qe0-f43.google.com with SMTP id 1so562970qec.30 for ; Mon, 29 Apr 2013 11:01:13 -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=DPtfkr04iqG0Gr1sijF13+hlpQtudafZ9WrSFdYWzVQ=; b=k80LUkFPMLw2j5bEyJnyFcqFG970Ea+M0exUvw4ECqsZZqxelJveb1iso1jPriN/N1 AfWBphJJ7o0jHLwsTm5G3YZC/sO7tQOPM+eSSgmVD0Xduiiw5226mGMGRLFiqMGRXI70 JUGdHcXA7nO9U9/8gMawkqhdbvr40H80CZ32jigUUnpDtWGvLi59XaO7pljYXs/GwaV9 obZLUh9fvtD/Csma6oGkT3zBKGjCHUwi5RjS6Xvp+OvzER+JQfl+d/RtwRmXlvOsGMxW Kwq00+jc4j3Tqk4XTISzo4kj1m4uUw4LIIqcnrAaFpV1hhanR1EIHuHFnDegpwNhpvVj 08ZA== X-Received: by 10.229.125.143 with SMTP id y15mr4460262qcr.129.1367258472847; Mon, 29 Apr 2013 11:01:12 -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 z2sm35808091qad.4.2013.04.29.11.01.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 29 Apr 2013 11:01:12 -0700 (PDT) Message-ID: <517EB567.60303@inktank.com> Date: Mon, 29 Apr 2013 13:01:11 -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/5] rbd: set up devices only for mapped images References: <517EB4F0.1070607@inktank.com> In-Reply-To: <517EB4F0.1070607@inktank.com> X-Gm-Message-State: ALoCoQlAZilz7n1mUxYNZPi3OhFG7VnpYSi8z5oB1inWX14Zl66DbkopL2VQmBCTV5/iLoiPb5qk Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org Stop setting up Linux devices during the image probe operation. Instead, set up the devices as a separate step after the image probe, in rbd_add(). A consequence of this is that only mapped images get devices assigned to them, which is pretty sweet. This resolves: http://tracker.ceph.com/issues/4774 Signed-off-by: Alex Elder --- drivers/block/rbd.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) err_out_probe: @@ -4966,9 +4961,12 @@ static ssize_t rbd_add(struct bus_type *bus, if (rc < 0) goto err_out_rbd_dev; - return count; + rc = rbd_dev_device_setup(rbd_dev); + if (!rc) + return count; + + rbd_dev_image_release(rbd_dev); err_out_rbd_dev: - kfree(rbd_dev->header_name); rbd_dev_destroy(rbd_dev); err_out_client: rbd_put_client(rbdc); @@ -5031,7 +5029,6 @@ static void rbd_dev_remove_parent(struct rbd_device *rbd_dev) second = third; } rbd_assert(second); - rbd_bus_del_dev(second); rbd_dev_image_release(second); first->parent = NULL; first->parent_overlap = 0; diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index ff850e9..8b680ad 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -4880,14 +4880,9 @@ static int rbd_dev_image_probe(struct rbd_device *rbd_dev) goto err_out_snaps; ret = rbd_dev_probe_parent(rbd_dev); - if (ret) - goto err_out_snaps; - - ret = rbd_dev_device_setup(rbd_dev); if (!ret) return 0; - rbd_dev_remove_parent(rbd_dev); err_out_snaps: rbd_remove_all_snaps(rbd_dev);