From patchwork Mon May 30 08:36:16 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Jansen X-Patchwork-Id: 829482 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p4U8aMg3004851 for ; Mon, 30 May 2011 08:36:22 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752164Ab1E3IgT (ORCPT ); Mon, 30 May 2011 04:36:19 -0400 Received: from mort.rzone.de ([81.169.144.234]:62992 "EHLO mort.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750812Ab1E3IgT (ORCPT ); Mon, 30 May 2011 04:36:19 -0400 Received: from gargravarr.store (gargravarr.store [192.168.42.236]) by mort.rzone.de (Postfix) with ESMTP id DBFA5A8; Mon, 30 May 2011 10:36:17 +0200 (MEST) Received: by gargravarr.store (Postfix, from userid 32466) id 3CBF044DCA; Mon, 30 May 2011 10:36:16 +0200 (CEST) From: Arne Jansen To: chris.mason@oracle.com, linux-btrfs@vger.kernel.org Subject: [PATCH] btrfs: false BUG_ON when degraded Date: Mon, 30 May 2011 10:36:16 +0200 Message-Id: <1306744576-1609-1-git-send-email-sensille@gmx.net> X-Mailer: git-send-email 1.7.3.4 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Mon, 30 May 2011 08:36:22 +0000 (UTC) In degraded mode the struct btrfs_device of missing devs don't have device->name set. A kstrdup of NULL correctly returns NULL. Don't BUG in this case. Signed-off-by: Arne Jansen --- fs/btrfs/volumes.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index c48214e..da541df 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -504,7 +504,7 @@ static int __btrfs_close_devices(struct btrfs_fs_devices *fs_devices) BUG_ON(!new_device); memcpy(new_device, device, sizeof(*new_device)); new_device->name = kstrdup(device->name, GFP_NOFS); - BUG_ON(!new_device->name); + BUG_ON(device->name && !new_device->name); new_device->bdev = NULL; new_device->writeable = 0; new_device->in_fs_metadata = 0;