Date: Thu, 30 Jul 1998 11:10:31 -0400 From: sbabkin@dcn.att.com To: hackers@FreeBSD.ORG Subject: MP, interlocks and vfs_busy Message-ID: <C50B6FBA632FD111AF0F0000C0AD71EEFF8B8E@dcn71.dcn.att.com>
next in thread | raw e-mail | index | archive | help
Hi!
I'm reading the VFS code and I don't quite understand the following
piece of code in vfs_busy():
if (mp->mnt_kern_flag & MNTK_UNMOUNT) {
if (flags & LK_NOWAIT)
return (ENOENT);
mp->mnt_kern_flag |= MNTK_MWAIT;
if (interlkp) {
simple_unlock(interlkp);
}
/*
* Since all busy locks are shared except the exclusive
* lock granted when unmounting, the only place that a
* wakeup needs to be done is at the release of the
* exclusive lock at the end of dounmount.
*/
tsleep((caddr_t)mp, PVFS, "vfs_busy", 0);
if (interlkp) {
simple_lock(interlkp);
}
return (ENOENT);
}
The interlocks are used for multiprocessor systems, right ? Then what
would be if another
CPU that is holding unmount lock will obtain simple lock and call
wakeup() when our CPU
is running around the comment: in end of simple_unlock() and beginning
of tsleep() ?
Is not it a race condition (of course, with low probablility because
this code will probably
take less time to execute than the code on another CPU, but still a
possible race
condition) ? Must not be the simple lock properly released inside
tsleep(), after adding
a request to sleep hash ?
-Sergey
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?C50B6FBA632FD111AF0F0000C0AD71EEFF8B8E>
