From patchwork Sat Apr 27 12:37:51 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 2497141 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 E54793FC64 for ; Sat, 27 Apr 2013 12:37:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755618Ab3D0Mhx (ORCPT ); Sat, 27 Apr 2013 08:37:53 -0400 Received: from mail-ia0-f171.google.com ([209.85.210.171]:47561 "EHLO mail-ia0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754997Ab3D0Mhw (ORCPT ); Sat, 27 Apr 2013 08:37:52 -0400 Received: by mail-ia0-f171.google.com with SMTP id r13so4307171iar.2 for ; Sat, 27 Apr 2013 05:37:52 -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=M8YoJsEa0OGqnCZXScv5+WWaCThR28EEfxLiBquGB38=; b=n9bkECejdOTmIEP77jR4QnfJryGh92i+uq0sQiguG58vl22aLptnkR9JnG0Ug47p/5 19rKhq3frgLUzZYhMqWZa0czrJHmTvu2LewV325Y1wcukLZ4RkRdQPQWpgMLkFKOKqet 3ZJhaPoQzDfsAitskryA+hhkf6o0wTN4aZBvLdNZWr6YM6xZzEKO5hAYHERGilPY144Y r9gR6/97XJRU420U4Bgus5m4CvwUk8ALuSbLfEYUuELv3i4kBFRITCMu505wxyd6gfrt ZgLYVNSA/1N7eX3UIdX/hkWvMOiq8F2melZFsvDUjn78V4qcMGNx+HdAMAIHqHv0MGdN wnXw== X-Received: by 10.42.136.67 with SMTP id s3mr26434161ict.31.1367066272204; Sat, 27 Apr 2013 05:37:52 -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 s16sm7749429ign.4.2013.04.27.05.37.51 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 27 Apr 2013 05:37:51 -0700 (PDT) Message-ID: <517BC69F.6020906@inktank.com> Date: Sat, 27 Apr 2013 07:37:51 -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/6] rbd: remove parent devices on probe error References: <517BC608.5030008@inktank.com> In-Reply-To: <517BC608.5030008@inktank.com> X-Gm-Message-State: ALoCoQmY+3QHGhoQ67++fKhS50mwEK3xPDkrtI2Km1QMWBVZyc2bQfyA2t6lhxsreGTWvNKMlMVk Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org When an error occurs while finishing probing a device it is assumed that parent devices get cleaned up when deleting a device. They don't. Add a call to clean them up. Note that this means the parent spec will already be cleaned up so it doesn't have to be in one of the rbd_add() error paths. Signed-off-by: Alex Elder --- drivers/block/rbd.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) return ret; @@ -4922,7 +4922,6 @@ 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: diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 99d231b..c81b319 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -4806,8 +4806,8 @@ static int rbd_dev_probe_finish(struct rbd_device *rbd_dev) return ret; err_out_bus: - /* this will also clean up rest of rbd_dev stuff */ - + if (rbd_dev->parent) + rbd_dev_remove_parent(rbd_dev); rbd_bus_del_dev(rbd_dev);