Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-77273

Improve xfs_quota user interface for default quotas

Linking RHIVOS CVEs to...Migration: Automation ...SWIFT: POC ConversionSync from "Extern...XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • rhel-10.0
    • xfsprogs
    • None
    • rhel-fs
    • 8
    • False
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • None
    • All
    • None

      Today, default quota limits on xfs do not seem to be visible to individual users via the xfs_quota command. (This is likely true for the generic repquota command as well, but that would be a separate effort.)

      As the xfs_quota man page explains, default quotas (quota limits enforced for users which have no explicit limit set on their UID) are stored in the quota information for UID 0. (UID 0, i.e. root, is not subject to these limits; it's simply where the default limit for every OTHER user is stored).

      However, as far as I can tell there is no way for unprivileged users to see these default limits, because they are stored on the (restricted) admin / ID 0 quota. Example:

      # mount -o quota /dev/loop0 /mnt/test
      # mkdir /mnt/test/testuser8
      # chown testuser8:testuser8 /mnt/test/testuser8
      # xfs_quota -x /mnt/test
      # xfs_quota -x /mnt/test
      xfs_quota> limit -u bsoft=10m  bhard=20m 0
      xfs_quota> limit -u isoft=300 ihard=400 testuser8
      xfs_quota> report -ub
      User quota on /mnt/test (/dev/loop0)
                                     Blocks                     
      User ID          Used       Soft       Hard    Warn/Grace     
      ---------- -------------------------------------------------- 
      root                0      10240      20480     00 [--------]
      testuser8           0          0          0     00 [--------]
      xfs_quota> report -ui
      User quota on /mnt/test (/dev/loop0)
                                     Inodes                     
      User ID          Used       Soft       Hard    Warn/ Grace     
      ---------- -------------------------------------------------- 
      root                3          0          0     00 [--------]
      testuser8           0        300        400     00 [--------]
      xfs_quota> 

      Here we have set default user block quota limits for all users, and specific user inode limits for testuser8, and root can see them both when queried.

      However, as testuser8, if we look at our own block and inode user quota limits:

      # su testuser8
      $ xfs_quota /mnt/test
      xfs_quota> quota -ub
      xfs_quota> quota -ui
      Disk quotas for User testuser8 (1008)
      Filesystem               Files      Quota      Limit  Warn/Time      Mounted on
      /dev/loop0                   1        300        400   00 [--------] /mnt/test
      xfs_quota> 
      

      The unprivileged user can see their own, unique user inode limits, but cannot see any default limits imposed on them for block usage by the default quota stored on UID 0.

      To fix this, I think we need to teach xfs_quota reporting functions to query whether a default quota limit exists (i.e. get quota info for UID 0), and if set, display those limits for any quotas which have not been explicitly set for the user. (If any quota /has/ been specifically set for the user, it should be shown, as it overrides the default.)

      To facilitate this, it is likely that a kernel change will also need to be made to allow unprivileged users to query (but not set!) quota limits for UID 0, because those limits do not limit UID 0, they limit unprivileged users.

              aalbersh@redhat.com Andrey Albershteyn
              esandeen@redhat.com Eric Sandeen
              Bill O'Donnell Bill O'Donnell
              Zirong Lang Zirong Lang
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated: