LTP inotify04 test fails with kernel v6.19
Subsystems (2)
Dai Ngo
reviewerThe regression was introduced by commit:
bd4928ec799b3 NFS: Avoid changing nlink when file removes and attribute updates race
After commit bd4928ec799b3, unlinking an NFSv4 file that has a delegation can leave inode->i_nlink incorrectly unchanged (stays 1). As a result, dentry_unlink_inode() may skip fsnotify_inoderemove(), and FS_DELETE_SELF is not delivered.
In this failing sequence:
. vfs_unlink() is called on an NFS inode that currently holds an NFSv4 delegation.
. delegation return triggers an attribute refresh that advances the inode’s
attribute generation:
. nfsi->attr_gencount is updated to fattr->gencount.
. fattr->gencount is set by nfs_fattr_init() in _nfs4_proc_delegreturn(). . the update to nfsi->attr_gencount happens from nfs4_delegreturn_release()
. when nfs_drop_nlink() later runs as part of the unlink path, it uses an older
gencount. Because nfsi->attr_gencount has already advanced, the check fails.
. The mismatch causes nfs_drop_nlink() to skip calling drop_nlink().
. With inode->i_nlink still 1, dentry_unlink_inode() skips fsnotify_inoderemove(),
so FS_DELETE_SELF is suppressed.
-Dai