Details
Description
If a user is running low of inode quota, it is possible for them to run out of free qunits to assign (multiple of 1000 inodes) but still have free inodes available assigned to the MDTs in the filesystem. Since clients to not track quota usage for each user themselves, the LMV MDT space balancing code may select an MDT that has free space but does not have any free quota for that user. This issue is made worse by having a large number of MDTs relative to the user's inode quota.
Rather than failing the mkdir with -EDQUOT immediately, it would be better to have the client try other available MDTs to see if it can create a new directory there. Ideally, if a client gets -EDQUOT back from mkdir, it would fetch the detailed quota usage from all MDTs for that user (like "lfs quota -v") and then use that information to prefer the MDT with the most free inodes.
Just doing a round-robin MDT selection (i.e. trying all MDTs in order) may select an MDT with only a small number of free inodes for the subdirectory, at which point the user would quickly run out of free inodes that can be created in the new directory and be stuck. Instead, selecting an MDT with the "most" free quota for the user will allow at least a reasonable number of files to be created in the directory (possibly a few hundreds).