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
This commit is contained in:
Conrad Meyer 2015-09-15 20:22:30 +00:00
parent 550e9d4235
commit 55d33667ee
3 changed files with 14 additions and 3 deletions

View File

@ -4344,6 +4344,15 @@ vop_mknod_post(void *ap, int rc)
VFS_KNOTE_LOCKED(a->a_dvp, NOTE_WRITE);
}
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)
{
@ -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 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))
kn->kn_flags |= (EV_EOF | EV_ONESHOT);
kn->kn_data = 0;
@ -4670,7 +4679,7 @@ filt_vfsvnode(struct knote *kn, long hint)
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);

View File

@ -355,6 +355,7 @@ vop_inactive {
%% reclaim vp E E E
%! reclaim post vop_reclaim_post
vop_reclaim {
IN struct vnode *vp;

View File

@ -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);