From owner-svn-src-projects@FreeBSD.ORG Wed Oct 23 18:35:07 2013 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 89276B5D; Wed, 23 Oct 2013 18:35:07 +0000 (UTC) (envelope-from will@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 773A22417; Wed, 23 Oct 2013 18:35:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9NIZ7LO093965; Wed, 23 Oct 2013 18:35:07 GMT (envelope-from will@svn.freebsd.org) Received: (from will@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9NIZ7YN093963; Wed, 23 Oct 2013 18:35:07 GMT (envelope-from will@svn.freebsd.org) Message-Id: <201310231835.r9NIZ7YN093963@svn.freebsd.org> From: Will Andrews Date: Wed, 23 Oct 2013 18:35:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r257003 - in projects/vps/sys: kern vps X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2013 18:35:07 -0000 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 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 #include +#define _VPS_USER_H__ONLY_FLAGS +#include #ifdef GPROF #include @@ -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); } }