Thank you Dave. This helps a lot. >> [ Please word wrap your emails at 72 columns! ] I will remember to do this in future. - Emalayan From: Dave Chinner <david@xxxxxxxxxxxxx> Sent: April 10, 2018 2:20 AM To: Vairavanathan, Emalayan Cc: linux-xfs@xxxxxxxxxxxxxxx Subject: Re: [Question] Behaviour of directory listing in XFS with concurrent deletes [ Please word wrap your emails at 72 columns! ] On Tue, Apr 10, 2018 at 12:24:55AM +0000, Vairavanathan, Emalayan wrote: > Hi Dave, > > Thank you for getting back to me. Please see my response inline. > > >> 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... > > Assume the following : > > 1) No failures (application crash OR disk / sector errors OR any > form of disk or memory corruption) > 2) xfs file-system is mounted with dirsync option. > 3) A directory in XFS with 1.2 million files. fsync() was called > on each file after creation. Directory Size, dirsync, fsync, and failures are irrelevant to readdir vs concurrent unlink behaviour. > 4) An application with two threads (Thread-A and Thread-B) that > uses this directory. Thread-A iterates through the directory and > lists the names of all the files in the directory using readdir > calls. The Thread-B concurrently deletes some files from the > directory. > 5) Files can be only deleted from the directory. No new files will > be created once the directory listing is started and we have a > coordination layer to ensure this. > Given this context: > - False-positive means a file that was deleted by Thread-B is seen > by Thread-A. > - False-negative means a file that is already in the directory is > not seen by Thread-A (due to concurrent deletes of some other > files in the directory). > > Does this make sense ? Yes. > I know that false-positives are possible in this context. Right, POSIX explicitly states that behaviour of readdir() w.r.t. files added/deleted after opendir()/rewinddir() is unspecified. > Is it possible to see false negatives in this > context? No. -Dave. -- Dave Chinner david@xxxxxxxxxxxxx -- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html