Description of problem:
We have setup a new RedHat 7 server, which acts as an nfs client, and mounts several nfs directories from RedHat 6 nfs servers.
User quotas has been enabled but not on all NFS servers.
Executing quota -u <username> from the nfs client, we get the output for the user, for his quotas, but for the filesystems that quota is off we get the error
"quota: error while getting quota from server1.xx.yy.zz:/sys-data/newfs for user1 (id 1099): Connection refused
Version-Release number of selected component (if applicable):
Set up NFS servers, and exports several filesystems, with quota enabled on few but not on all of them.
Mount the filesystems on nfs redhat 7 client
Steps to Reproduce:
1.execute quota -u <username>
quota: error while getting quota from server1.xx.yy.zz:/sys-data/newfs:/sys-data/newfs for user1(id 1099): Connection refused
quota: error while getting quota from server2.xx.yy.zz:/sys-data/WebData for user1 (id 1099): Connection refused
Disk quotas for user user1 (uid 1099):
Filesystem blocks quota limit grace files quota limit grace
0 0 0 0 0 0
3291744 10240000 15360000 26266 0 0
For filesystems that there is no quotas enabled, either should not displayed at all, or should display with 0 under quota limit columns.
That's because quotas are enforced on the server. There is no "noquota" mount option for nfs mount types, therefore the client has no way how to know that the server does not support quotas. It has to query the server.
The "Connection refused" means there was an error when querying the server. The quota tools needs to report errors.
So the question is if the client can distinguish an error from non-existing quota RPC service.
What if the nfs client, perform checks, on the mounted filesystem, to find if the aquota.user and aquota.group files exists. If there, means that quota have been enforced otherwise not.
This is not an universal check. There are file systems which implements quotas without quota files.
I see two possible solutions:
(1) Add noquota mount option to nfs type mounts.
(2) Recognize special state where server's RPC mapper is reachable, but the rquota service is not registered there. I don't know if there is a such capability in the rpc(3) API. But that wound still require a round trip to the server and back
Simple workaround is to run the rpc.rquotad daemon on all NFS servers.
I proposed a patch to the quota tools' upstream. It works but I'm not sure whether it's a perfect solution.
Created attachment 949864 [details]
Created attachment 961550 [details]
Upstream accepted the patch with some small tunes.
How to test:
(1) Mount an NFS file system (The file system can have quotas disabled.)
(2) Make sure the quota RPC service (rpc-rquotad.service on RHEL-7) is not
running on the server.
(2) Run "quota" command to list current user's quotas.
A warning message is displayed on standard error output and the exit code
quota: error while getting quota from 127.0.0.1:/mnt/1 for test (id 1000): Connection refused
No warning is printed.
To prevent from regressions, please make sure that if the quota RPC service is running and the exported files system has enabled quotas, the quota(1) tool will report quotas for the user.
Also you can check that if the quota RPC service is running and the exported files system has enabled quotas, but access to the RPC service is disabled (e.g. by a rule in the /etc/hosts.deny), then the quota(1) tool will still report this error state by the above quoted warning message.
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.