Page MenuHomeFreeBSD

inotify: Fix a couple of locking bugs
ClosedPublic

Authored by markj on Jul 18 2025, 1:22 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Sep 11, 12:30 PM
Unknown Object (File)
Fri, Sep 11, 6:10 AM
Unknown Object (File)
Fri, Sep 11, 6:05 AM
Unknown Object (File)
Mon, Sep 7, 4:24 PM
Unknown Object (File)
Fri, Sep 4, 5:35 PM
Unknown Object (File)
Sat, Aug 29, 7:28 PM
Unknown Object (File)
Sat, Aug 29, 7:24 PM
Unknown Object (File)
Sat, Aug 29, 7:21 PM
Subscribers

Details

Summary

When hooking vop_rename_post(), the preexisting dst vnode will be
unlocked. But, we need to invoke VOP_GETATTR on it in vn_inotify() to
check its link count.

In inotify_unlink_watch_locked(), the vnode interlock is not held, so
don't use vn_irflag_unset_locked().

Fixes: f1f230439fa4 ("vfs: Initial revision of inotify")

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

markj requested review of this revision.Jul 18 2025, 1:22 AM
sys/sys/inotify.h
110

_[A_Z]* are not good names for global macros.
I suggest e.g. INOTIFY_NAME_LOCK() or similar.

117

Same as () are not needed in around vp/dvp in lines 111/112.

markj marked 2 inline comments as done.

Handle kib's notes.

This revision is now accepted and ready to land.Jul 18 2025, 1:55 PM
This revision was automatically updated to reflect the committed changes.