From patchwork Thu Nov 30 07:53:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Misono Tomohiro X-Patchwork-Id: 10084315 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8806A6035E for ; Thu, 30 Nov 2017 07:53:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 78E8729ECA for ; Thu, 30 Nov 2017 07:53:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6D94729EE5; Thu, 30 Nov 2017 07:53:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E82A329ECA for ; Thu, 30 Nov 2017 07:53:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751912AbdK3HxU (ORCPT ); Thu, 30 Nov 2017 02:53:20 -0500 Received: from mgwym04.jp.fujitsu.com ([211.128.242.43]:50167 "EHLO mgwym04.jp.fujitsu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750898AbdK3HxT (ORCPT ); Thu, 30 Nov 2017 02:53:19 -0500 Received: from yt-mxauth.gw.nic.fujitsu.com (unknown [192.168.229.68]) by mgwym04.jp.fujitsu.com with smtp id 581a_1a44_652b8c80_c00d_4736_9b3c_fcc81b99a9cd; Thu, 30 Nov 2017 16:53:16 +0900 Received: from g01jpfmpwkw02.exch.g01.fujitsu.local (g01jpfmpwkw02.exch.g01.fujitsu.local [10.0.193.56]) by yt-mxauth.gw.nic.fujitsu.com (Postfix) with ESMTP id A626AAC002B for ; Thu, 30 Nov 2017 16:53:16 +0900 (JST) Received: from g01jpexchkw36.g01.fujitsu.local (unknown [10.0.193.4]) by g01jpfmpwkw02.exch.g01.fujitsu.local (Postfix) with ESMTP id C4AB93287E9 for ; Thu, 30 Nov 2017 16:53:15 +0900 (JST) X-SecurityPolicyCheck: OK by SHieldMailChecker v2.5.2 X-SHieldMailCheckerPolicyVersion: FJ-ISEC-20170217-enc X-SHieldMailCheckerMailID: 5f07ff482f5c4d0f98f766526d89029b Subject: [PATCH 3/3] btrfs-progs: fi usage: cleanup unneccessary permission error check From: "Misono, Tomohiro" To: linux-btrfs References: <12571738-34cb-412c-a512-3b117d4726e9@jp.fujitsu.com> Message-ID: <9be13116-09f2-6f24-7e81-d215f5b215cc@jp.fujitsu.com> Date: Thu, 30 Nov 2017 16:53:12 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <12571738-34cb-412c-a512-3b117d4726e9@jp.fujitsu.com> Content-Language: en-US X-SecurityPolicyCheck-GC: OK by FENCE-Mail X-TM-AS-MML: disable Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since BTRFS_IOC_FS_INFO does not require root privilege, there is no need to check EPERM error. Signed-off-by: Tomohiro Misono Reviewed-by: Qu Wenruo --- cmds-fi-usage.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/cmds-fi-usage.c b/cmds-fi-usage.c index 7bbc9896..b0721560 100644 --- a/cmds-fi-usage.c +++ b/cmds-fi-usage.c @@ -522,8 +522,6 @@ static int load_device_info(int fd, struct device_info **device_info_ptr, ret = ioctl(fd, BTRFS_IOC_FS_INFO, &fi_args); if (ret < 0) { - if (errno == EPERM) - return -errno; error("cannot get filesystem info: %s", strerror(errno)); return 1; @@ -597,11 +595,6 @@ int load_chunk_and_device_info(int fd, struct chunk_info **chunkinfo, } ret = load_device_info(fd, devinfo, devcount); - if (ret == -EPERM) { - warning( - "cannot get filesystem info from ioctl(FS_INFO), run as root"); - ret = 0; - } return ret; }