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

report overflowed nlink counter correctly for striped dirs.

Details

    • Bug
    • Resolution: Fixed
    • Minor
    • Lustre 2.17.0
    • None
    • 3
    • 9223372036854775807

    Description

      on ldiskfs backend, if shards of a striped dir have more than ~64k subdirectories , the reported nlink attribute for the striped directory is incorrect:

      [root@rocky tests]# ../utils/lfs mkdir -c 2 /mnt/lustre/dir-c2
      [root@rocky tests]# for x in {0..160}; do for y in {0..999} ; do mkdir /mnt/lustre/dir-c2/$x-$y; done; echo .. ${x}k ..; done
      .. 0k ..
      .. 1k ..
      .. 2k ..
      .. 3k ..
      .. 4k ..
      ...
      .. 160k ..
      [root@rocky tests]# stat /mnt/lustre/dir-c2
        File: /mnt/lustre/dir-c2
        Size: 7815168   	Blocks: 15280      IO Block: 1048576 directory
      Device: 2c54f966h/743766374d	Inode: 144115205289279489  Links: 0
      Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
      Access: 2025-03-10 19:50:11.000000000 +0300
      Modify: 2025-03-10 19:53:07.000000000 +0300
      Change: 2025-03-10 19:53:07.000000000 +0300
       Birth: 2025-03-10 19:50:11.000000000 +0300
      [root@rocky tests]# 
      

      as you see, the nlink count is 0.

      Attachments

        Activity

          [LU-18791] report overflowed nlink counter correctly for striped dirs.
          pjones Peter Jones added a comment -

          Merged for 2.17

          pjones Peter Jones added a comment - Merged for 2.17
          gerrit Gerrit Updater added a comment -

          "Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/58357/
          Subject: LU-18791 lmv: report an overflowed nlink correctly
          Project: fs/lustre-release
          Branch: master
          Current Patch Set:
          Commit: b968372d746012a868c742d75ac8062cc361a07a

          gerrit Gerrit Updater added a comment - "Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/58357/ Subject: LU-18791 lmv: report an overflowed nlink correctly Project: fs/lustre-release Branch: master Current Patch Set: Commit: b968372d746012a868c742d75ac8062cc361a07a
          zam Alexander Zarochentsev added a comment - - edited

          with the same test (w/o the fix) on 3-striped dir we get a negative number truncated to u32, which is also incorrect.

          [root@rocky tests]# ../utils/lfs mkdir -c 3 /mnt/lustre/dir-c3
          [root@rocky tests]# ../utils/lfs getdirstripe /mnt/lustre/dir-c3
          lmv_stripe_count: 3 lmv_stripe_offset: 0 lmv_hash_type: crush
          mdtidx		 FID[seq:oid:ver]
               0		 [0x200000400:0x2:0x0]		
               2		 [0x280000402:0x2:0x0]		
               1		 [0x240000402:0x2:0x0]		
          [root@rocky tests]# for x in {0..200}; do for y in {0..999} ; do mkdir /mnt/lustre/dir-c3/$x-$y; done; echo .. ${x}k ..; done
          .. 0k ..
          .. 1k ..
          .. 2k ..
          .. 3k ..
          .. 4k ..
          .. 5k ..
          ...
          .. 199k ..
          .. 200k ..
          [root@rocky tests]# stat /mnt/lustre/dir-c3
            File: /mnt/lustre/dir-c3
            Size: 10043392  	Blocks: 19640      IO Block: 1048576 directory
          Device: 2c54f966h/743766374d	Inode: 144115205306056705  Links: 64378
          Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
          Access: 2025-03-10 20:31:27.000000000 +0300
          Modify: 2025-03-10 20:34:53.000000000 +0300
          Change: 2025-03-10 20:34:53.000000000 +0300
           Birth: 2025-03-10 20:31:27.000000000 +0300
          [root@rocky tests]# 
          
          zam Alexander Zarochentsev added a comment - - edited with the same test (w/o the fix) on 3-striped dir we get a negative number truncated to u32, which is also incorrect. [root@rocky tests]# ../utils/lfs mkdir -c 3 /mnt/lustre/dir-c3 [root@rocky tests]# ../utils/lfs getdirstripe /mnt/lustre/dir-c3 lmv_stripe_count: 3 lmv_stripe_offset: 0 lmv_hash_type: crush mdtidx FID[seq:oid:ver] 0 [0x200000400:0x2:0x0] 2 [0x280000402:0x2:0x0] 1 [0x240000402:0x2:0x0] [root@rocky tests]# for x in {0..200}; do for y in {0..999} ; do mkdir /mnt/lustre/dir-c3/$x-$y; done; echo .. ${x}k ..; done .. 0k .. .. 1k .. .. 2k .. .. 3k .. .. 4k .. .. 5k .. ... .. 199k .. .. 200k .. [root@rocky tests]# stat /mnt/lustre/dir-c3 File: /mnt/lustre/dir-c3 Size: 10043392 Blocks: 19640 IO Block: 1048576 directory Device: 2c54f966h/743766374d Inode: 144115205306056705 Links: 64378 Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2025-03-10 20:31:27.000000000 +0300 Modify: 2025-03-10 20:34:53.000000000 +0300 Change: 2025-03-10 20:34:53.000000000 +0300 Birth: 2025-03-10 20:31:27.000000000 +0300 [root@rocky tests]#

          repeating the test with the fix applied:

          .. 144k ..
          .. 145k ..
          .. 146k ..
          .. 147k ..
          .. 148k ..
          .. 149k ..
          .. 150k ..
          .. 151k ..
          .. 152k ..
          .. 153k ..
          .. 154k ..
          .. 155k ..
          .. 156k ..
          .. 157k ..
          .. 158k ..
          .. 159k ..
          .. 160k ..
          [root@rocky tests]# stat /mnt/lustre/dir-c2
            File: /mnt/lustre/dir-c2
            Size: 7856128   	Blocks: 15360      IO Block: 1048576 directory
          Device: 2c54f966h/743766374d	Inode: 144115205289279489  Links: 1
          Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
          Access: 2025-03-10 20:09:38.000000000 +0300
          Modify: 2025-03-10 20:12:09.000000000 +0300
          Change: 2025-03-10 20:12:09.000000000 +0300
           Birth: 2025-03-10 20:09:38.000000000 +0300
          [root@rocky tests]# 
          

          nlinks = 1, as in ldiskfs.

          zam Alexander Zarochentsev added a comment - repeating the test with the fix applied: .. 144k .. .. 145k .. .. 146k .. .. 147k .. .. 148k .. .. 149k .. .. 150k .. .. 151k .. .. 152k .. .. 153k .. .. 154k .. .. 155k .. .. 156k .. .. 157k .. .. 158k .. .. 159k .. .. 160k .. [root@rocky tests]# stat /mnt/lustre/dir-c2 File: /mnt/lustre/dir-c2 Size: 7856128 Blocks: 15360 IO Block: 1048576 directory Device: 2c54f966h/743766374d Inode: 144115205289279489 Links: 1 Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2025-03-10 20:09:38.000000000 +0300 Modify: 2025-03-10 20:12:09.000000000 +0300 Change: 2025-03-10 20:12:09.000000000 +0300 Birth: 2025-03-10 20:09:38.000000000 +0300 [root@rocky tests]# nlinks = 1, as in ldiskfs.

          "Alexander Zarochentsev <alexander.zarochentsev@hpe.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/58357
          Subject: LU-18791 lmv: report an overflowed nlink correctly
          Project: fs/lustre-release
          Branch: master
          Current Patch Set: 1
          Commit: 6389649d8fa31af66e2c84d6146a5b3c815fbf52

          gerrit Gerrit Updater added a comment - "Alexander Zarochentsev <alexander.zarochentsev@hpe.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/58357 Subject: LU-18791 lmv: report an overflowed nlink correctly Project: fs/lustre-release Branch: master Current Patch Set: 1 Commit: 6389649d8fa31af66e2c84d6146a5b3c815fbf52

          People

            zam Alexander Zarochentsev
            zam Alexander Zarochentsev
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: