From owner-cvs-src-old@FreeBSD.ORG Tue Dec 16 23:16:42 2008 Return-Path: Delivered-To: cvs-src-old@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BEDA51065745 for ; Tue, 16 Dec 2008 23:16:42 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id AAC828FC1C for ; Tue, 16 Dec 2008 23:16:42 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id mBGNGg1T052958 for ; Tue, 16 Dec 2008 23:16:42 GMT (envelope-from attilio@repoman.freebsd.org) Received: (from svn2cvs@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id mBGNGgo5052957 for cvs-src-old@freebsd.org; Tue, 16 Dec 2008 23:16:42 GMT (envelope-from attilio@repoman.freebsd.org) Message-Id: <200812162316.mBGNGgo5052957@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: svn2cvs set sender to attilio@repoman.freebsd.org using -f From: Attilio Rao Date: Tue, 16 Dec 2008 23:16:10 +0000 (UTC) To: cvs-src-old@freebsd.org X-FreeBSD-CVS-Branch: HEAD Subject: cvs commit: src/sys/kern vfs_mount.c vfs_subr.c src/sys/sys mount.h X-BeenThere: cvs-src-old@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: **OBSOLETE** CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Dec 2008 23:16:42 -0000 attilio 2008-12-16 23:16:10 UTC FreeBSD src repository Modified files: sys/kern vfs_mount.c vfs_subr.c sys/sys mount.h Log: SVN rev 186197 on 2008-12-16 23:16:10Z by attilio 1) Fix a deadlock in the VFS: - threadA runs vfs_rel(mp1) - threadB does unmount the mp1 fs, sets MNTK_UNMOUNT and drop MNT_ILOCK() - threadA runs vfs_busy(mp1) and, as long as, MNTK_UNMOUNT is set, sleeps waiting for threadB to complete the unmount - threadB, in vfs_mount_destroy(), finds mnt_lock > 0 and sleeps waiting for the refcount to expire. Fix the deadlock by adding a flag called MNTK_REFEXPIRE which signals the unmounter is waiting for mnt_ref to expire. The vfs_busy contenders got awake, fails, and if they retry the MNTK_REFEXPIRE won't allow them to sleep again. 2) Simplify significantly the code of vfs_mount_destroy() trimming unnecessary codes: - as long as any reference exited, it is no-more possible to have write-op (primarty and secondary) in progress. - it is no needed to drop and reacquire the mount lock. - filling the structures with dummy values is unuseful as long as it is going to be freed. Tested by: pho, Andrea Barberio Discussed with: kib Revision Changes Path 1.298 +14 -31 src/sys/kern/vfs_mount.c 1.750 +1 -1 src/sys/kern/vfs_subr.c 1.240 +1 -0 src/sys/sys/mount.h