diff options
Diffstat (limited to 'sys/kern/vfs_inotify.c')
-rw-r--r-- | sys/kern/vfs_inotify.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/kern/vfs_inotify.c b/sys/kern/vfs_inotify.c index 9562350c897f..d3cd0d1f9832 100644 --- a/sys/kern/vfs_inotify.c +++ b/sys/kern/vfs_inotify.c @@ -371,7 +371,7 @@ inotify_unlink_watch_locked(struct inotify_softc *sc, struct inotify_watch *watc TAILQ_REMOVE(&vp->v_pollinfo->vpi_inotify, watch, vlink); if (TAILQ_EMPTY(&vp->v_pollinfo->vpi_inotify)) - vn_irflag_unset_locked(vp, VIRF_INOTIFY); + vn_irflag_unset(vp, VIRF_INOTIFY); } /* @@ -503,7 +503,7 @@ inotify_can_coalesce(struct inotify_softc *sc, struct inotify_event *evp) return (prev != NULL && prev->ev.mask == evp->mask && prev->ev.wd == evp->wd && prev->ev.cookie == evp->cookie && prev->ev.len == evp->len && - (evp->len == 0 || strcmp(prev->ev.name, evp->name) == 0)); + memcmp(prev->ev.name, evp->name, evp->len) == 0); } static void @@ -675,7 +675,8 @@ vn_inotify(struct vnode *vp, struct vnode *dvp, struct componentname *cnp, struct vattr va; int error; - error = VOP_GETATTR(vp, &va, cnp->cn_cred); + error = VOP_GETATTR(vp, &va, + cnp->cn_cred); if (error == 0 && va.va_nlink != 0) selfevent = 0; } @@ -760,9 +761,11 @@ vn_inotify_add_watch(struct vnode *vp, struct inotify_softc *sc, uint32_t mask, * directory if it's specified as a vnode. */ vrefact(vp); + VOP_UNLOCK(vp); NDINIT_ATVP(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, dp->d_name, vp); error = namei(&nd); + vn_lock(vp, LK_SHARED | LK_RETRY); if (error != 0) break; vn_irflag_set_cond(nd.ni_vp, VIRF_INOTIFY_PARENT); |