Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Oct 2008 10:07:28 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r184073 - head/sys/kern
Message-ID:  <200810201007.m9KA7SJQ066155@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Mon Oct 20 10:07:28 2008
New Revision: 184073
URL: http://svn.freebsd.org/changeset/base/184073

Log:
  In vfs_busy(), lockmgr() cannot legitimately sleep, because code checked
  MNTK_UNMOUNT before, and mnt_mtx is used as interlock. vfs_busy() always
  tries to obtain a shared lock on mnt_lock, the other user is unmount who
  tries to drain it, setting MNTK_UNMOUNT before.
  
  Reviewed by:	tegge, attilio
  Tested by:	pho
  MFC after:	2 weeks

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==============================================================================
--- head/sys/kern/vfs_subr.c	Mon Oct 20 08:44:14 2008	(r184072)
+++ head/sys/kern/vfs_subr.c	Mon Oct 20 10:07:28 2008	(r184073)
@@ -368,7 +368,7 @@ vfs_busy(struct mount *mp, int flags, st
 	}
 	if (interlkp)
 		mtx_unlock(interlkp);
-	lkflags = LK_SHARED | LK_INTERLOCK;
+	lkflags = LK_SHARED | LK_INTERLOCK | LK_NOWAIT;
 	if (lockmgr(&mp->mnt_lock, lkflags, MNT_MTX(mp)))
 		panic("vfs_busy: unexpected lock failure");
 	return (0);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200810201007.m9KA7SJQ066155>