]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_quota: Don't ignore every error when asking for quota
authorArkadiusz Miskiewicz <arekm@maven.pl>
Tue, 30 Dec 2008 17:32:05 +0000 (18:32 +0100)
committerChristoph Hellwig <hch@brick.lst.de>
Tue, 30 Dec 2008 17:32:05 +0000 (18:32 +0100)
Errors from quotactl() were silently ignored like:

$ xfs_quota -x -c "report -u -L 12000 -U 12001"
$

Print error messages for conditions other than ENOENT and ENOSYS
(these two aren't actually errors for the way quotactl is used).

We now get:

$ ./xfs_quota -x -c "report -u -L 12000 -U 12001"  /home
XFS_GETQUOTA: Operation not permitted
XFS_GETQUOTA: Operation not permitted
$

which is consistent with error reporting in rest of quotactl using code.

Reviewed-by: Christoph Hellwig <hch@lst.de>
quota/report.c

index 21841582b9d4a8840765b1496126cc98de3e9c0a..73248d0858b57857d025c83b6a5776e78e43e98a 100644 (file)
@@ -81,8 +81,11 @@ dump_file(
 {
        fs_disk_quota_t d;
 
-       if (xfsquotactl(XFS_GETQUOTA, dev, type, id, (void *)&d) < 0)
+       if (xfsquotactl(XFS_GETQUOTA, dev, type, id, (void *)&d) < 0) {
+               if (errno != ENOENT && errno != ENOSYS)
+                       perror("XFS_GETQUOTA");
                return;
+       }
        if (!d.d_blk_softlimit && !d.d_blk_hardlimit &&
            !d.d_ino_softlimit && !d.d_ino_hardlimit &&
            !d.d_rtb_softlimit && !d.d_rtb_hardlimit)
@@ -298,8 +301,11 @@ report_mount(
        uint            qflags;
        int             count;
 
-       if (xfsquotactl(XFS_GETQUOTA, dev, type, id, (void *)&d) < 0)
+       if (xfsquotactl(XFS_GETQUOTA, dev, type, id, (void *)&d) < 0) {
+               if (errno != ENOENT && errno != ENOSYS)
+                       perror("XFS_GETQUOTA");
                return 0;
+       }
 
        if (flags & TERSE_FLAG) {
                count = 0;
@@ -514,8 +520,10 @@ report_any_type(
        if (type & XFS_USER_QUOTA) {
                fs_cursor_initialise(dir, FS_MOUNT_POINT, &cursor);
                while ((mount = fs_cursor_next_entry(&cursor))) {
-                       xfsquotactl(XFS_QSYNC, mount->fs_name,
-                                               XFS_USER_QUOTA, 0, NULL);
+                       if (xfsquotactl(XFS_QSYNC, mount->fs_name,
+                                               XFS_USER_QUOTA, 0, NULL) < 0
+                                       && errno != ENOENT && errno != ENOSYS)
+                               perror("XFS_QSYNC user quota");
                        report_user_mount(fp, form, mount,
                                                lower, upper, flags);
                }
@@ -523,8 +531,10 @@ report_any_type(
        if (type & XFS_GROUP_QUOTA) {
                fs_cursor_initialise(dir, FS_MOUNT_POINT, &cursor);
                while ((mount = fs_cursor_next_entry(&cursor))) {
-                       xfsquotactl(XFS_QSYNC, mount->fs_name,
-                                               XFS_GROUP_QUOTA, 0, NULL);
+                       if (xfsquotactl(XFS_QSYNC, mount->fs_name,
+                                               XFS_GROUP_QUOTA, 0, NULL) < 0
+                                       && errno != ENOENT && errno != ENOSYS)
+                               perror("XFS_QSYNC group quota");
                        report_group_mount(fp, form, mount,
                                                lower, upper, flags);
                }
@@ -532,8 +542,10 @@ report_any_type(
        if (type & XFS_PROJ_QUOTA) {
                fs_cursor_initialise(dir, FS_MOUNT_POINT, &cursor);
                while ((mount = fs_cursor_next_entry(&cursor))) {
-                       xfsquotactl(XFS_QSYNC, mount->fs_name,
-                                               XFS_PROJ_QUOTA, 0, NULL);
+                       if (xfsquotactl(XFS_QSYNC, mount->fs_name,
+                                               XFS_PROJ_QUOTA, 0, NULL) < 0
+                                       && errno != ENOENT && errno != ENOSYS)
+                               perror("XFS_QSYNC proj quota");
                        report_project_mount(fp, form, mount,
                                                lower, upper, flags);
                }