Paul Eggert wrote: > On 07/31/2012 09:52 AM, Jim Meyering wrote: >> fstat uses a file descriptor. >> Calling fstatfs on that same file descriptor should >> give a reliable (race-free) file system type. > > Ah, sorry, I thought the idea was to cache the > statfs info so that we didn't need to invoke > two system calls for each file. But yes, if > there's no cache we should be OK.
Using cached st_dev -> FS-type(is-compressing-FS) information is critical. Can you outline how a grep -r X A B C might go astray due to such a cache entry becoming stale, assuming we clear the cache between command line arguments? While processing each argument, I see no risk that the device associated with our open directory FDs will be remounted on a different device with a different class of file system.
