svn commit: r259817 - stable/10/sys/kern

Konstantin Belousov kib at FreeBSD.org
Tue Dec 24 07:32:07 UTC 2013


Author: kib
Date: Tue Dec 24 07:32:06 2013
New Revision: 259817
URL: http://svnweb.freebsd.org/changeset/base/259817

Log:
  MFC r259522:
  If vn_open_vnode() succeeded in opening the vnode, but subsequent
  advisory lock cannot be obtained, prevent double-close of the vnode in
  vn_close() called from the fdrop(), by resetting file' f_ops methods.

Modified:
  stable/10/sys/kern/vfs_vnops.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/vfs_vnops.c
==============================================================================
--- stable/10/sys/kern/vfs_vnops.c	Tue Dec 24 07:27:55 2013	(r259816)
+++ stable/10/sys/kern/vfs_vnops.c	Tue Dec 24 07:32:06 2013	(r259817)
@@ -313,6 +313,9 @@ vn_open_vnode(struct vnode *vp, int fmod
 			vn_lock(vp, lock_flags | LK_RETRY);
 			(void)VOP_CLOSE(vp, fmode, cred, td);
 			vn_finished_write(mp);
+			/* Prevent second close from fdrop()->vn_close(). */
+			if (fp != NULL)
+				fp->f_ops= &badfileops;
 			return (error);
 		}
 		fp->f_flag |= FHASLOCK;


More information about the svn-src-all mailing list