Details
-
Improvement
-
Resolution: Duplicate
-
Major
-
None
-
Lustre 2.6.0
-
14581
Description
In LU-4906 the code was changed to read directory entries one page at a time instead of one entry at a time. This improves performance with "rm -r" workloads where entries are being deleted on the MDS and the DLM lock on the directory is being revoked repeatedly, but the client needs to keep fetching it to continue the readdir.
According to SuSv2 it is permissible for readdir() to not be 100% consistent if entries are being added or deleted while readdir() is ongoing:
http://pubs.opengroup.org/onlinepubs/007908799/xsh/readdir.html
If a file is removed from or added to the directory after the most recent call to opendir() or rewinddir(), whether a subsequent call to readdir() returns an entry for that file is unspecified.
The readdir() function may buffer several directory entries per actual read operation; readdir() marks for update the st_atime field of the directory each time the directory is actually read.
So in summary, it is possible to cache the readdir() contents on the client, even after the DLM lock is revoked so long as it is only cached on the open file descriptor, and is invalidated upon file close or rewinddir().