xfs
[Top] [All Lists]

[PATCH V3] xfs_quota: don't try to report quotas which aren't there.

To: xfs-oss <xfs@xxxxxxxxxxx>
Subject: [PATCH V3] xfs_quota: don't try to report quotas which aren't there.
From: Eric Sandeen <sandeen@xxxxxxxxxx>
Date: Fri, 18 Feb 2011 12:02:11 -0600
In-reply-to: <4D5EB27C.3070306@xxxxxxxxxx>
References: <4D5EB09A.3030605@xxxxxxxxxx> <4D5EB27C.3070306@xxxxxxxxxx>
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7
Red Hat bug #669333 - xfs_quota generates "XFS_GETQUOTA: No such process" errors
shows that if you do this for a filesystem w/o group quota enabled:

# xfs_quota -x -c ' report -h ' /xfsquota"

You'll get this output:

User quota on /xfsquota (/dev/vdb)
                        Blocks              
User ID      Used   Soft   Hard Warn/Grace   
---------- --------------------------------- 
root            0      0      0  00 [------]

XFS_GETQUOTA: No such process
XFS_GETQUOTA: No such process
...

because we're calling XFS_GETQUOTA for types which aren't enabled.

The below patch fixes it for me, just ignoring types that aren't
there.

V2: Thanks to Arkadiusz Miskiewicz for pointing out the simpler fix.
V3: Thanks again to Arkadiusz for suggesting fixing dump as well

Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>
---


diff --git a/quota/report.c b/quota/report.c
index 0e005c3..8653590 100644
--- a/quota/report.c
+++ b/quota/report.c
@@ -82,7 +82,7 @@ dump_file(
        fs_disk_quota_t d;
 
        if (xfsquotactl(XFS_GETQUOTA, dev, type, id, (void *)&d) < 0) {
-               if (errno != ENOENT && errno != ENOSYS)
+               if (errno != ENOENT && errno != ENOSYS && errno != ESRCH)
                        perror("XFS_GETQUOTA");
                return;
        }
@@ -302,7 +302,7 @@ report_mount(
        int             count;
 
        if (xfsquotactl(XFS_GETQUOTA, dev, type, id, (void *)&d) < 0) {
-               if (errno != ENOENT && errno != ENOSYS)
+               if (errno != ENOENT && errno != ENOSYS && errno != ESRCH)
                        perror("XFS_GETQUOTA");
                return 0;
        }

<Prev in Thread] Current Thread [Next in Thread>