Date: Wed, 11 Sep 2002 13:09:04 -0400 (EDT) From: John Baldwin <jhb@FreeBSD.org> To: "Andrew R. Reiter" <arr@FreeBSD.org> Cc: cvs-all@FreeBSD.org, cvs-committers@FreeBSD.org Subject: RE: cvs commit: src/sys/kern kern_acct.c Message-ID: <XFMail.20020911130904.jhb@FreeBSD.org> In-Reply-To: <200209110410.g8B4Aggt079926@freefall.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 11-Sep-2002 Andrew R. Reiter wrote:
> arr 2002/09/10 21:10:41 PDT
>
> Modified files:
> sys/kern kern_acct.c
> Log:
> - Lock down the accounting code globals with a subsystem mutex.
>
> Reviewed by: jhb, mdodd
Erm, well, I reviewed an earlier version and had some comments. :) More
comments:
@@ -323,12 +340,15 @@
{
struct statfs sb;
+ mtx_lock(&acct_mtx);
+
if (savacctp != NULLVP) {
if (savacctp->v_type == VBAD) {
(void) vn_close(savacctp, savacctflags, savacctcred,
NULL);
savacctp = NULLVP;
savacctcred = NOCRED;
+ mtx_unlock(&acct_mtx);
return;
}
(void)VFS_STATFS(savacctp->v_mount, &sb, (struct thread *)0);
This should probably be changed at the end after the second 'if' to save
savacctp and savacctcred in temp vars, clear the two variables, then
drop the lock. Then do a vn_close() with the temp variables.
You should probably also drop the lock while you do VFS_STATFS. vref() the
vnode before dropping, then after VFS_STATFS() you can get the lock again
and compare the vp saved in a temp variable to savacctp and just vrele()
the temp vp if they don't match, otherwise proceed with the current code.
--
John Baldwin <jhb@FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve!" - http://www.FreeBSD.org/
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.20020911130904.jhb>
