From patchwork Tue Dec 23 19:34:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Maggard X-Patchwork-Id: 5534861 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 413D39F2F7 for ; Tue, 23 Dec 2014 19:37:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 42AB22010C for ; Tue, 23 Dec 2014 19:37:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 715F7200F4 for ; Tue, 23 Dec 2014 19:37:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751451AbaLWThF (ORCPT ); Tue, 23 Dec 2014 14:37:05 -0500 Received: from mail-pa0-f43.google.com ([209.85.220.43]:50544 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750725AbaLWThD (ORCPT ); Tue, 23 Dec 2014 14:37:03 -0500 Received: by mail-pa0-f43.google.com with SMTP id kx10so8533358pab.2 for ; Tue, 23 Dec 2014 11:37:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=ticwQIdbFYeDtodXFdyOY/68C/MhFF2qLyTLCmMqnZw=; b=SBK+KbZE0pAWNan+ml7620qbi6MC+HZljE9DVfb2eyR538r36KKlYqXXuITYYovw9y IzWdJ9cgboOrqQjVO7/XaCdqjjcMT6BxLlZvzmvZkvoG6Em6i+7M7z+g3VMKgn1t8TFt XBX90DycDeGlUFbSoNTQx+xXFZ1AtdewadYxiJZVh/ab8uqFPK5VrVi8QIMVv/PV2YWW e8BYH0OOP90BzKSrGYHEYPav6S1LIWBNKF70ZGamzwvxyEuuuaWHMZT/tWB/5F9YmW+F em84YSTo02bInhD2l+X0rDsfqGb+Dx0Iz+43+CdnOBL6KVzsL5HmpyvEMUZoLpwhwKka wPgw== X-Received: by 10.70.59.35 with SMTP id w3mr47196235pdq.104.1419363423286; Tue, 23 Dec 2014 11:37:03 -0800 (PST) Received: from wheezy-jm.infrant-6.com ([209.249.181.1]) by mx.google.com with ESMTPSA id gx1sm20681094pbd.57.2014.12.23.11.37.01 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Dec 2014 11:37:02 -0800 (PST) From: Justin Maggard To: linux-btrfs@vger.kernel.org Cc: Justin Maggard Subject: [PATCH] btrfs-progs: Fix btrfs fi show by uuid and label Date: Tue, 23 Dec 2014 11:34:52 -0800 Message-Id: <1419363292-12271-1-git-send-email-jmaggard10@gmail.com> X-Mailer: git-send-email 1.7.10.4 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Commit 8be2fff (btrfs-progs: apply realpath for btrfs fi show when mount point is given) changed the behavior of btrfs fi show to return an error if the call to realpath() failed. This broke the ability to specify a filesystem by uuid or label. So let's not consider a failed call to realpath() as an error. If the user really specified a bad device, just return nothing like we did before. Reviewed-by: Gui Hecheng --- cmds-filesystem.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/cmds-filesystem.c b/cmds-filesystem.c index 8f037dd..a654e6f 100644 --- a/cmds-filesystem.c +++ b/cmds-filesystem.c @@ -901,13 +901,8 @@ static int cmd_show(int argc, char **argv) * realpath do /mnt/btrfs/ => /mnt/btrfs * which shall be recognized by btrfs_scan_kernel() */ - if (!realpath(search, path)) { - fprintf(stderr, "ERROR: Could not show %s: %s\n", - search, strerror(errno)); - return 1; - } - - search = path; + if (realpath(search, path)) + search = path; /* * Needs special handling if input arg is block dev And if