Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-19018

fallocate by-passes quota limits initially, subsequent fallocate Fails correctly with EDQUOT

Details

    • Bug
    • Resolution: Unresolved
    • Blocker
    • None
    • Lustre 2.16.1
    • None
    • Lustre 2.15 / EL7 or Lustre 2.16 / EL9
    • 2
    • 9223372036854775807

    Description

      Hello! I just realized that posix_fallocate() allows users to bypass Lustre quota enforcement. Tested against Lustre 2.15.5 and 2.16.1.

      I'm attaching a simple fallocate helper fallocate.c that I used below.

      We assume quota enforcement is enabled here (osd-ldiskfs.lustre-OST*.quota_slave_dt.enabled=up):

      User quota enforcement:

      $ lfs setquota -u sthiell -B 1T /elm
      
      $ ./fallocate bigfalloc-user $(( 2 * 1024 * 1024 * 1024 * 1024 )) 
      
      $ stat bigfalloc-user
        File: bigfalloc-user
        Size: 2199023255552	Blocks: 4294968080 IO Block: 4194304 regular file
      Device: 899af214h/2308633108d	Inode: 144115441093058211  Links: 1
      Access: (0644/-rw-r--r--)  Uid: (282232/ sthiell)   Gid: (  100/   users)
      Access: 2025-05-14 15:39:29.000000000 -0700
      Modify: 2025-05-14 15:39:29.000000000 -0700
      Change: 2025-05-14 15:39:29.000000000 -0700
       Birth: 2025-05-14 15:39:29.000000000 -0700
      
      $ lfs quota -u sthiell -h  /elm/
      Disk quotas for usr sthiell (uid 282232):
            Filesystem    used   quota   limit   grace   files   quota   limit   grace
                 /elm/      2T*     0k      1T       -       5       0       0       -
      

      On another system, I was able to bypass project quotas in the same way.

      $ ./fallocate /scratch/users/sthiell/bigfalloc $(( 10 * 1024 * 1024 * 1024 * 1024 ))
      Successfully allocated 10995116277760 bytes for file /scratch/users/sthiell/bigfalloc
      
      
      $ lfs quota -p 282232 -h /scratch/
      Disk quotas for prj 282232 (pid 282232):
           Filesystem    used   quota   limit   grace   files   quota   limit   grace
            /scratch/    112T*     0k    100T       -    4849       0 104857600       -
      pid 282232 is using default block quota setting
      

      Originally discovered with dtar which makes use of posix_fallocate() to preallocate the resulting tar file. It seems pretty important to fix this ASAP.

      Attachments

        1. dd.run.gz
          552 kB
        2. fallocate_mod.c
          1.0 kB
        3. fallocate.c
          0.9 kB
        4. fallocate.run.gz
          447 kB
        5. lfallocate.sh
          0.7 kB

        Activity

          People

            arshad512 Arshad Hussain
            sthiell Stephane Thiell
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated: