Date: Tue, 18 Feb 2003 21:44:17 -0700 From: Scott Long <scott_long@btc.adaptec.com> To: alfred@freebsd.org Cc: cvs-all@freebsd.org, src-committers@freebsd.org Subject: [Fwd: [alfred@FreeBSD.org: cvs commit: src/sys/kern kern_descrip.c kern_event.c kern_exit.c vfs_mount.c src/sys/sys filedesc.h]] Message-ID: <3E530BA1.8040407@btc.adaptec.com>
next in thread | raw e-mail | index | archive | help
> alfred 2003/02/14 21:52:56 PST
>
> Modified files:
> sys/kern kern_descrip.c kern_event.c kern_exit.c
> vfs_mount.c
> sys/sys filedesc.h
> Log:
> Fix LOR with PROC/filedesc. Introduce fdesc_mtx that will be used
> as a barrier between free'ing filedesc structures. Basically if
> you want to access another process's filedesc, you want to hold
> this mutex over the entire operation.
>
> Revision Changes Path
> 1.186 +11 -1 src/sys/kern/kern_descrip.c
> 1.55 +1 -1 src/sys/kern/kern_event.c
> 1.194 +1 -1 src/sys/kern/kern_exit.c
> 1.101 +3 -3 src/sys/kern/vfs_mount.c
> 1.50 +2 -0 src/sys/sys/filedesc.h
The change in kern_descrip.c has a side effect of breaking the
nvidia.ko driver and diskless workstations that are NFS mounted
and have rpc.lockd enabled. The problem is that td->td_proc->p_fd
is set to null before closef(*fpp, td) is called. The patch below
fixes this and doesn't cause any locking issues that I can tell:
cvs diff: Diffing .
Index: kern_descrip.c
===================================================================
RCS file: /usr/ncvs/src/sys/kern/kern_descrip.c,v
retrieving revision 1.188
diff -u -r1.188 kern_descrip.c
--- kern_descrip.c 15 Feb 2003 22:43:05 -0000 1.188
+++ kern_descrip.c 19 Feb 2003 04:20:06 -0000
@@ -1412,10 +1412,6 @@
if (fdp == NULL)
return;
- mtx_lock(&fdesc_mtx);
- td->td_proc->p_fd = NULL;
- mtx_unlock(&fdesc_mtx);
-
FILEDESC_LOCK(fdp);
if (--fdp->fd_refcnt > 0) {
FILEDESC_UNLOCK(fdp);
@@ -1432,6 +1428,11 @@
if (*fpp)
(void) closef(*fpp, td);
}
+
+ mtx_lock(&fdesc_mtx);
+ td->td_proc->p_fd = NULL;
+ mtx_unlock(&fdesc_mtx);
+
if (fdp->fd_nfiles > NDFILE)
FREE(fdp->fd_ofiles, M_FILEDESC);
if (fdp->fd_cdir)
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?3E530BA1.8040407>
