Author: cem
Date: Tue Sep 15 20:22:30 2015
New Revision: 287831
URL: https://svnweb.freebsd.org/changeset/base/287831

Log:
  kevent(2): Note DOOMED vnodes with NOTE_REVOKE
  
  In poll mode, check for and wake VBAD vnodes.  (Vnodes that are VBAD at
  registration will never be woken by the RECLAIM trigger.)
  
  Add post-VOP_RECLAIM hook to trigger notes on vnode reclamation.  (Vnodes that
  were fine at registration but are vgoned while being monitored should signal
  waiters.)
  
  Reviewed by:  kib
  Approved by:  markj (mentor)
  Sponsored by: EMC / Isilon Storage Division
  Differential Revision:        https://reviews.freebsd.org/D3675

Modified:
  head/sys/kern/vfs_subr.c
  head/sys/kern/vnode_if.src
  head/sys/sys/vnode.h

Modified: head/sys/kern/vfs_subr.c
==============================================================================
--- head/sys/kern/vfs_subr.c    Tue Sep 15 20:04:30 2015        (r287830)
+++ head/sys/kern/vfs_subr.c    Tue Sep 15 20:22:30 2015        (r287831)
@@ -4345,6 +4345,15 @@ vop_mknod_post(void *ap, int rc)
 }
 
 void
+vop_reclaim_post(void *ap, int rc)
+{
+       struct vop_reclaim_args *a = ap;
+
+       if (!rc)
+               VFS_KNOTE_LOCKED(a->a_vp, NOTE_REVOKE);
+}
+
+void
 vop_remove_post(void *ap, int rc)
 {
        struct vop_remove_args *a = ap;
@@ -4624,7 +4633,7 @@ filt_vfsread(struct knote *kn, long hint
         * filesystem is gone, so set the EOF flag and schedule
         * the knote for deletion.
         */
-       if (hint == NOTE_REVOKE) {
+       if (hint == NOTE_REVOKE || (hint == 0 && vp->v_type == VBAD)) {
                VI_LOCK(vp);
                kn->kn_flags |= (EV_EOF | EV_ONESHOT);
                VI_UNLOCK(vp);
@@ -4653,7 +4662,7 @@ filt_vfswrite(struct knote *kn, long hin
         * filesystem is gone, so set the EOF flag and schedule
         * the knote for deletion.
         */
-       if (hint == NOTE_REVOKE)
+       if (hint == NOTE_REVOKE || (hint == 0 && vp->v_type == VBAD))
                kn->kn_flags |= (EV_EOF | EV_ONESHOT);
 
        kn->kn_data = 0;
@@ -4670,7 +4679,7 @@ filt_vfsvnode(struct knote *kn, long hin
        VI_LOCK(vp);
        if (kn->kn_sfflags & hint)
                kn->kn_fflags |= hint;
-       if (hint == NOTE_REVOKE) {
+       if (hint == NOTE_REVOKE || (hint == 0 && vp->v_type == VBAD)) {
                kn->kn_flags |= EV_EOF;
                VI_UNLOCK(vp);
                return (1);

Modified: head/sys/kern/vnode_if.src
==============================================================================
--- head/sys/kern/vnode_if.src  Tue Sep 15 20:04:30 2015        (r287830)
+++ head/sys/kern/vnode_if.src  Tue Sep 15 20:22:30 2015        (r287831)
@@ -355,6 +355,7 @@ vop_inactive {
 
 
 %% reclaim     vp      E E E
+%! reclaim     post    vop_reclaim_post
 
 vop_reclaim {
        IN struct vnode *vp;

Modified: head/sys/sys/vnode.h
==============================================================================
--- head/sys/sys/vnode.h        Tue Sep 15 20:04:30 2015        (r287830)
+++ head/sys/sys/vnode.h        Tue Sep 15 20:22:30 2015        (r287831)
@@ -781,6 +781,7 @@ void        vop_lookup_post(void *a, int rc);
 void   vop_lookup_pre(void *a);
 void   vop_mkdir_post(void *a, int rc);
 void   vop_mknod_post(void *a, int rc);
+void   vop_reclaim_post(void *a, int rc);
 void   vop_remove_post(void *a, int rc);
 void   vop_rename_post(void *a, int rc);
 void   vop_rename_pre(void *a);
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to