Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 May 2016 02:35:33 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r299885 - in stable/10/sys: kern sys
Message-ID:  <201605160235.u4G2ZXGd089223@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Mon May 16 02:35:33 2016
New Revision: 299885
URL: https://svnweb.freebsd.org/changeset/base/299885

Log:
  MFC r287831 (by cem):
  Note DOOMED vnodes with NOTE_REVOKE.

Modified:
  stable/10/sys/kern/vfs_subr.c
  stable/10/sys/kern/vnode_if.src
  stable/10/sys/sys/vnode.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/vfs_subr.c
==============================================================================
--- stable/10/sys/kern/vfs_subr.c	Mon May 16 02:35:23 2016	(r299884)
+++ stable/10/sys/kern/vfs_subr.c	Mon May 16 02:35:33 2016	(r299885)
@@ -4351,6 +4351,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;
@@ -4647,7 +4656,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);
@@ -4676,7 +4685,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;
@@ -4693,7 +4702,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: stable/10/sys/kern/vnode_if.src
==============================================================================
--- stable/10/sys/kern/vnode_if.src	Mon May 16 02:35:23 2016	(r299884)
+++ stable/10/sys/kern/vnode_if.src	Mon May 16 02:35:33 2016	(r299885)
@@ -355,6 +355,7 @@ vop_inactive {
 
 
 %% reclaim	vp	E E E
+%! reclaim	post	vop_reclaim_post
 
 vop_reclaim {
 	IN struct vnode *vp;

Modified: stable/10/sys/sys/vnode.h
==============================================================================
--- stable/10/sys/sys/vnode.h	Mon May 16 02:35:23 2016	(r299884)
+++ stable/10/sys/sys/vnode.h	Mon May 16 02:35:33 2016	(r299885)
@@ -774,6 +774,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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605160235.u4G2ZXGd089223>