Bug 1326527

Summary: quota can show incorrect filesystem name
Product: [Fedora] Fedora Reporter: Jason Tibbitts <j>
Component: quotaAssignee: Petr Pisar <ppisar>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: adm.fkt.physik, ovasik, ppisar
Target Milestone: ---Keywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
URL: https://sourceforge.net/p/linuxquota/feature-requests/14/
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-06-10 07:01:20 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Jason Tibbitts 2016-04-12 22:56:25 UTC
On a server, I have one export: /export/web-00.  It has two subdirectories: "tibbs" and "dave".  The automounter is running with a map on /www containing:

cn: tibbs
nisMapName: auto.www
nisMapEntry: web2:/export/web-00/tibbs

cn: dave
nisMapName: auto.www
nisMapEntry: web2:/export/web-00/dave

I do "ls /www/tibbs /www/dave" to mount them both.  Then "quota" shows:

Disk quotas for user tibbs (uid 7225):
     Filesystem  blocks   quota   limit   grace   files   quota   limit   grace
web2:/export/web-00/dave
                11129408* 10485760 20971520   6days    1115       0       0

df shows:

web2:/export/web-00/dave            52403200  11473920  40929280  22% /www/dave
web2:/export/web-00/tibbs           52403200  11473920  40929280  22% /www/tibbs

And if I umount /www/dave, quota then does show me the correct filesystem name.

So, yes, on the server they're the same filesystem.  But on the client, they aren't, and I guess it would be nice if it could tell me the actual mount that is over quota as it's a bit confusing for the user to see their quota on someone else's volume.  I've no idea if this is possible, though.  For now I have my own tools which try to fix this up.

Comment 1 Petr Pisar 2016-04-13 08:48:33 UTC
> to see their quota on someone else's volume

How can you tell a mount point is mine or other's volume? There is no such notion in Linux or POSIX. The mount points or remote directories can have arbitrary names, these are meaningless strings.

In my opinion, there are two reasons for the observed behavior:

(1) quota displays mount device names (web2:/export/web-00/dave). Not mount point names (/www/dave).

(2) quota lists each device only once, it does not display them repeatedly for each mount point mounted from the same device. See quota(1) manual page:

       quota  reports  the  quotas of all the filesystems listed in /etc/mtab.
       For filesystems that are NFS-mounted a call to the rpc.rquotad  on  the
       server machine is performed to get the information.

Be ware that NFS does not export a directory tree. I exports a file systems. Yes, I know NFSv4 make it more complicated.

I agree that the output is confusing. But what could make it better?

(1) List mount point names instead of device names. That could sometimes make things better because it would display a path that user uses locally.

(2) List all mount points even if they originate from the same file system. That would be great in case of small amount of these mount points. But imagine a server with tens or hunderts of logged in users, each with his mount point. Then the output would be illegibly long and with a wrong implementation could lead to massive repeated RPC requests for the same data.

I really cannot see a general solution. I will forward your issue to upstream, maybe someone else comes with better idea.

Comment 2 Petr Pisar 2016-04-13 09:01:22 UTC
Actually it's all already implemented:

(1) with --show-mntpoint (and --hide-device) options,

(2) with --all-nfs option.

So the only remaining problem is "How can you tell a mount point is mine or other's volume?"

The answer could be check ownership of a root directory of the file system mounted to the mount point. There could be a new option that would restrict the file system selection to only those whose top-level directory is owner by the user.

Comment 3 Jason Tibbitts 2016-04-19 18:08:55 UTC
Thanks for responding.  I wasn't sure that there was any way to do this, but I figured it wouldn't hurt to ask.

I wasn't aware of --all-nfs; It's still confusing but seems to be useful.

I actually provide utilities for my users so that they don't have to run quota themselves, so I can just use --all-nfs and stat the mountpoints.

Though what I really should do is use the quota system calls directly instead of parsing the output of the quota command.

Comment 4 Petr Pisar 2016-06-10 07:01:20 UTC
Upstream thinks the decision on what mount point is best to present to an user is subjective and thus does not belong into quota command. But the upstream is keen to merge an additional wrapper on top of the quota command that implements the decision and filters the "quota --all-nfs" output.

If you think your script are useful, feel free to submit it to the upstream directly. You can use the opened feature request <https://sourceforge.net/p/linuxquota/feature-requests/14/>.