svn commit: r257003 - in projects/vps/sys: kern vps

Will Andrews will at FreeBSD.org
Wed Oct 23 18:35:07 UTC 2013


Author: will
Date: Wed Oct 23 18:35:06 2013
New Revision: 257003
URL: http://svnweb.freebsd.org/changeset/base/257003

Log:
  Sync with svn.7he.at/vps/trunk r198.
  
  r198 | klaus | 2013-07-30 03:17:00 -0600 (Tue, 30 Jul 2013) | 4 lines
  Added check in deadlkres() for dead vps instances;
  and added locking in vps_deref() where the destroy task is initialized.
  
  Submitted by:	Klaus P. Ohrhallinger <k at 7he.at>

Modified:
  projects/vps/sys/kern/kern_clock.c
  projects/vps/sys/vps/vps_core.c

Modified: projects/vps/sys/kern/kern_clock.c
==============================================================================
--- projects/vps/sys/kern/kern_clock.c	Wed Oct 23 18:34:06 2013	(r257002)
+++ projects/vps/sys/kern/kern_clock.c	Wed Oct 23 18:35:06 2013	(r257003)
@@ -72,6 +72,8 @@ __FBSDID("$FreeBSD$");
 
 #include <vps/vps.h>
 #include <vps/vps2.h>
+#define _VPS_USER_H__ONLY_FLAGS
+#include <vps/vps_user.h>
 
 #ifdef GPROF
 #include <sys/gmon.h>
@@ -214,6 +216,8 @@ deadlkres(void)
 		save_vps = curthread->td_vps;
 		sx_slock(&vps_all_lock);
 		LIST_FOREACH_SAFE(vps, &vps_head, vps_all, vps_tmp) {
+		if (vps->vps_status == VPS_ST_DEAD)
+			continue;
 		vps_ref(vps, (struct ucred *)&deadlkres);
 		sx_sunlock(&vps_all_lock);
 		curthread->td_vps = vps;

Modified: projects/vps/sys/vps/vps_core.c
==============================================================================
--- projects/vps/sys/vps/vps_core.c	Wed Oct 23 18:34:06 2013	(r257002)
+++ projects/vps/sys/vps/vps_core.c	Wed Oct 23 18:35:06 2013	(r257003)
@@ -848,6 +848,7 @@ vps_deref(struct vps *vps, struct ucred 
 #endif
 
 	if (last) {
+		sx_xlock(&vps->vps_lock);
 		KASSERT(vps->vps_status == VPS_ST_DEAD,
 		    ("%s: vps=%p; released last reference but "
 		    "vps_status = %d\n", __func__, vps, vps->vps_status));
@@ -875,6 +876,7 @@ vps_deref(struct vps *vps, struct ucred 
 		    vps_destroy_task, vps);
 		taskqueue_enqueue_timeout(taskqueue_thread, &vps->vps_task,
 		    1 * hz /* ticks */);
+		sx_xunlock(&vps->vps_lock);
 	}
 }
 


More information about the svn-src-projects mailing list