Re: [Question] Behaviour of directory listing in XFS with concurrent deletes

Dave Chinner
2018-04-06T01:18:13Z

On Thu, Apr 05, 2018 at 11:53:18PM +0000, Vairavanathan, Emalayan wrote:
> Hi There,
>
>
> We have an application that iterates through a large directory
> (that has around 1.2 million files) and lists the names of all
> the files in the directory.
>
> Files stored in the directory could be concurrently deleted by
> another thread in the application while the application lists the
> files.

XFS complies with Posix requirements for stable directory offsets.
i.e. that dirents don't change offset when other dirents are added
or removed. Hence sequential readdir calls will always start off at
the dirent offset the last call finished at.

However, this guarantees nothing about individual dirent state
when concurrent modifications occur between readdir calls.

> Our application can tolerate false positives when listing a
> directory. However false negatives in directory listing *cannot*
> be tolerated.
>
> To this end could someone tell me how directory listing in XFS
> behaves with concurrent deletes? Is it possible to see false
> negatives ?

What's does "false-negative" mean? I don't know what your
application is trying to do, so I don't know what your failure
criteria is....

Cheers,

Dave.