Supporting >32K links in a directory and incorrect ls –l output

Article: 100006482
Last Published: 2014-11-19
Ratings: 0 0
Product(s): InfoScale & Storage Foundation

Problem

On AIX the number of links (sub-directories) in a directory is limited to 32767 (MAXLINK). As there are always 2 links within a directory (one to itself and one to its parent), this means that a maximum 32765 additional sub-directories may be created.

 

As From patch 5.1SP1RP1HF6 Veritas File System (VxFS) for AIX new functionality was added such that VxFS no longer limits the number of links and does not use MAXLINK. From this patch Level more than 32767 links in a directory are allowed. Although the new physical limit is 4294967295 links this may affect usability of the directory hence Veritas advises that no more than 131072 links be created.

 

After applying this (or a later) patch, the new functionality can be enabled as follows (note that all VxFS filesystems must be un-mounted for the change to take effect):

 vxtunefs -D maxlink_enable=1

To display if the feature is enabled:

vxtunefs -D print

Once enabled, all vxfs filesystems will be allowed to create more than 32K links. It must be noted that should you create more than 32K links the filesystem may not be usable on systems which do NOT have this level of patch or above.

However, as the Operating System is limited by MAXLINK the following commands will show inconsistent output if more than MAXLINK  sub-directories exist:

 /usr/bin/istat, /usr/bin/li, /usr/bin/ls and /usr/bin/find

 

 

Error Message

Attempting to create too many sub-directories will result in an error similar to:

WARNING: msgcnt <increment> mesg 128: V-2-128: number of links reached vx_maxlink for inode <related to FS path> on filesystem <path>

In the following example we increase the number of sub-directories and monitor the number of links reported by 'ls -l'. With maxlink_enable set to one, we can see that as soon as we increase the number of sub-directories beyond 32767 an incorrect number of links is output:

# ls -l
drwxr-xr-x 32766 root     system       573440 Sep 22 20:48 dir2

# mkdir dir2/e

# ls -l
drwxr-xr-x 32767 root     system       573440 Sep 22 20:48 dir2

# mkdir dir2/f

# ls -l
drwxr-xr-x 4294934528 root     system       573440 Sep 22 20:49 dir2

 

Cause

The OS commands assume there will not be greater than MAXLINK subdirectories and internally use a 32-bit signed integer to store the value. As VxFS now allows more links than the OS limit, the value shown by the OS commands is incorrect.

Solution

 An enhancement to the AIX operating system would be required such that the MAXLINK limit is increased.


Applies To

 The issue is limited to the AIX operating system where the  maxlink_enable feature is used.

Was this content helpful?