btrfs-progs: subvol show: don't return error if quotas are not enabled

The command 'subvolume show' would return error code in case quotas are
not enabled or in any other error. In case they're not enabled, it's not
fatal, no-qgroup setups are quite common.

Signed-off-by: David Sterba <dsterba@suse.com>
master
David Sterba 2019-06-19 20:50:59 +02:00
parent ceacaa112e
commit f0aab17fc0
1 changed files with 11 additions and 8 deletions

View File

@ -1129,20 +1129,23 @@ static int cmd_subvol_show(const struct cmd_struct *cmd, int argc, char **argv)
btrfs_util_destroy_subvolume_iterator(iter);
ret = btrfs_qgroup_query(fd, subvol.id, &stats);
if (ret && ret != -ENOTTY && ret != -ENODATA) {
fprintf(stderr,
"\nERROR: BTRFS_IOC_QUOTA_QUERY failed: %s\n",
strerror(-ret));
if (ret == -ENOTTY) {
/* Quotas not enabled */
ret = 0;
goto out;
}
if (ret == -ENOTTY) {
/* Quota information not available, not fatal */
printf("\tQuota group:\t\tn/a\n");
ret = 0;
goto out;
}
if (ret) {
if (ret == -ENOTTY)
printf("quotas not enabled\n");
else
printf("quotas not available\n");
fprintf(stderr, "ERROR: quota query failed: %m");
goto out;
}
printf("\tQuota group:\t\t0/%" PRIu64 "\n", subvol.id);
fflush(stdout);