svn commit: r207700 - head/sys/kern

Alan Cox alc at FreeBSD.org
Thu May 6 15:52:08 UTC 2010


Author: alc
Date: Thu May  6 15:52:08 2010
New Revision: 207700
URL: http://svn.freebsd.org/changeset/base/207700

Log:
  Eliminate a small bit of unneeded code from kern_sendfile(): While
  kern_sendfile() is running, the file's vm object can't be destroyed
  because kern_sendfile() increments the vm object's reference count.  (Once
  kern_sendfile() decrements the reference count and returns, the vm object
  can, however, be destroyed.  So, sf_buf_mext() must handle the case where
  the vm object is destroyed.)
  
  Reviewed by:	kib

Modified:
  head/sys/kern/uipc_syscalls.c

Modified: head/sys/kern/uipc_syscalls.c
==============================================================================
--- head/sys/kern/uipc_syscalls.c	Thu May  6 12:37:01 2010	(r207699)
+++ head/sys/kern/uipc_syscalls.c	Thu May  6 15:52:08 2010	(r207700)
@@ -2139,14 +2139,9 @@ retry_space:
 			    (mnw ? SFB_NOWAIT : SFB_CATCH))) == NULL) {
 				mbstat.sf_allocfail++;
 				vm_page_lock(pg);
-				vm_page_lock_queues();
 				vm_page_unwire(pg, 0);
-				/*
-				 * XXX: Not same check as above!?
-				 */
-				if (pg->wire_count == 0 && pg->object == NULL)
-					vm_page_free(pg);
-				vm_page_unlock_queues();
+				KASSERT(pg->object != NULL,
+				    ("kern_sendfile: object disappeared"));
 				vm_page_unlock(pg);
 				error = (mnw ? EAGAIN : EINTR);
 				break;


More information about the svn-src-head mailing list