svn commit: r184073 - head/sys/kern

Konstantin Belousov kib at FreeBSD.org
Mon Oct 20 10:07:29 UTC 2008


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);


More information about the svn-src-head mailing list