On Mon, Nov 18, 2024 at 01:37:19AM +0900, Jeongjun Park wrote: > Many filesystems lock inodes before calling vfs_getattr, so there is no > data-race for inodes. However, some functions in fs/stat.c that call > vfs_getattr do not lock inodes, so the data-race occurs. > > Therefore, we need to apply a patch to remove the long-standing data-race > for inodes in some functions that do not lock inodes. The lock does nothing useful here. The moment the lock is dropped, the information in the stat buffer is out of date (i.e. stale) and callers need to treat it as such. i.e. stat data is a point in time snapshot of inode state and nothing more. Holding the inode lock over the getattr call does not change this - the information returned by getattr is not guaranteed to be up to date by the time the caller reads it. i.e. If a caller needs stat information to be serialised against other operations on the inode, then it needs to hold the inode lock itself.... -Dave. -- Dave Chinner david@xxxxxxxxxxxxx