X-Spam-Checker-Version: SpamAssassin 3.3.0-rupdated (updated) on oss.sgi.com X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.0-rupdated Received: from cuda.sgi.com (cuda3.sgi.com [192.48.176.15]) by oss.sgi.com (8.12.11.20060308/8.12.11/SuSE Linux 0.7) with ESMTP id mBG7rC6Q022690 for ; Tue, 16 Dec 2008 01:53:12 -0600 X-ASG-Debug-ID: 1229413989-3e7800ac0000-w1Z2WR X-Barracuda-URL: http://cuda.sgi.com:80/cgi-bin/mark.cgi Received: from carme.pld-linux.org (localhost [127.0.0.1]) by cuda.sgi.com (Spam Firewall) with ESMTP id 26EE9173A68C for ; Mon, 15 Dec 2008 23:53:09 -0800 (PST) Received: from carme.pld-linux.org (carme.pld-linux.org [193.239.45.140]) by cuda.sgi.com with ESMTP id 6ESXeKPFPzRFE0gn for ; Mon, 15 Dec 2008 23:53:09 -0800 (PST) Received: from arekm by carme.pld-linux.org with local (Exim 4.69) (envelope-from ) id 1LCUjs-000tCT-L5; Tue, 16 Dec 2008 08:53:08 +0100 From: Arkadiusz Miskiewicz To: linux-xfs@oss.sgi.com Cc: Arkadiusz Miskiewicz X-ASG-Orig-Subj: [PATCH] xfs_quota: Don't ignore every error when asking for quota. Subject: [PATCH] xfs_quota: Don't ignore every error when asking for quota. Date: Tue, 16 Dec 2008 08:53:08 +0100 Message-Id: <1229413988-212167-1-git-send-email-arekm@maven.pl> X-Mailer: git-send-email 1.6.0.5 X-Barracuda-Connect: carme.pld-linux.org[193.239.45.140] X-Barracuda-Start-Time: 1229413991 X-Barracuda-Bayes: INNOCENT GLOBAL 0.0000 1.0000 -2.0210 X-Barracuda-Virus-Scanned: by cuda.sgi.com at sgi.com X-Barracuda-Spam-Score: -2.02 X-Barracuda-Spam-Status: No, SCORE=-2.02 using per-user scores of TAG_LEVEL=2.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=2.1 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.1.12851 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 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. --- xfsprogs/quota/report.c | 28 ++++++++++++++++++++-------- 1 files changed, 20 insertions(+), 8 deletions(-) diff --git a/xfsprogs/quota/report.c b/xfsprogs/quota/report.c index 2184158..73248d0 100644 --- a/xfsprogs/quota/report.c +++ b/xfsprogs/quota/report.c @@ -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); } -- 1.6.0.5