On 07/31/2012 10:14 AM, Jim Meyering wrote: > 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?
For example, one could have 'grep -R X A', where A contains symlinks that point into another file system, and that file system could be remounted between the time one symlink is visted, and the next. The problem could occur without symlinks as well. A could be a tree above two mounted file systems A/F and A/G. 'grep -r X A' visits A/F first. After it stops visiting A/F, A/F is unmounted and A/G mounted, with the same device number as A/F. grep then visits A/G and uses incorrect cached info about A/G's status. xstat should work, assuming it's designed well. But surely SEEK_HOLE will be available sooner, for ext4. I see there's active development in that area now <http://comments.gmane.org/gmane.linux.file-systems/66117>.
