diff mbox

[v2,3/3] btrfs-progs: fi usage: cleanup unnecessary permission error check

Message ID a7a4f704-f2bc-1231-dec2-de5524f3bbdd@jp.fujitsu.com (mailing list archive)
State New, archived
Headers show

Commit Message

Misono Tomohiro March 29, 2018, 8:23 a.m. UTC
Since BTRFS_IOC_FS_INFO does not require root privilege, there is no
need to check EPERM error.

Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com>
---
 cmds-fi-usage.c | 7 -------
 1 file changed, 7 deletions(-)

Comments

David Sterba March 30, 2018, 5:21 p.m. UTC | #1
On Thu, Mar 29, 2018 at 05:23:39PM +0900, Misono Tomohiro wrote:
> Since BTRFS_IOC_FS_INFO does not require root privilege, there is no
> need to check EPERM error.

Well, this has been changed in 3.16, but there's still 3.2 longterm
kernel. It does not hurt to have the check and verbose message so we may
need to keep it for a few more years.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/cmds-fi-usage.c b/cmds-fi-usage.c
index 2d45b3bb..5ce87a37 100644
--- a/cmds-fi-usage.c
+++ b/cmds-fi-usage.c
@@ -549,8 +549,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: %m");
 		return 1;
 	}
@@ -635,11 +633,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;
 }