File 0171-btrfs-progs-qgroup-show-refine-error-messages.patch of Package btrfsprogs.11414
From: David Sterba <dsterba@suse.com>
Date: Fri, 20 Jan 2017 17:52:12 +0100
Subject: btrfs-progs: qgroup show: refine error messages
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git
Git-commit: 7610cbf729003952f76fddf67439fc0499139ff6
Patch-mainline: v4.9.1
References: bsc#1045577
When qgroup show is called on a filesystem that does not have quotas
enabled, the error message is very unclear:
ERROR: can't perform the search - No such file or directory
ERROR: can't list qgroups: No such file or director
Remove the error from low level helper and let the command handler
decide what to print.
Signed-off-by: David Sterba <dsterba@suse.com>
Acked-by: Jeff Mahoney <jeffm@suse.com>
---
cmds-qgroup.c | 8 ++++++--
qgroup.c | 7 ++-----
2 files changed, 8 insertions(+), 7 deletions(-)
--- a/cmds-qgroup.c
+++ b/cmds-qgroup.c
@@ -379,9 +379,13 @@ static int cmd_qgroup_show(int argc, cha
}
ret = btrfs_show_qgroups(fd, filter_set, comparer_set);
e = errno;
+ if (ret < 0) {
+ if (e == ENOENT)
+ error("can't list qgroups: quotas not enabled");
+ else
+ error("can't list qgroups: %s", strerror(e));
+ }
close_file_or_dir(fd, dirstream);
- if (ret < 0)
- error("can't list qgroups: %s", strerror(e));
return !!ret;
}
--- a/qgroup.c
+++ b/qgroup.c
@@ -1074,12 +1074,9 @@ static int __qgroups_search(int fd, stru
while (1) {
ret = ioctl(fd, BTRFS_IOC_TREE_SEARCH, &args);
- if (ret < 0) {
- fprintf(stderr,
- "ERROR: can't perform the search - %s\n",
- strerror(errno));
+ if (ret < 0)
return ret;
- }
+
/* the ioctl returns the number of item it found in nr_items */
if (sk->nr_items == 0)
break;