From owner-cvs-all Tue Feb 18 20:44:39 2003 Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A41F237B401; Tue, 18 Feb 2003 20:44:36 -0800 (PST) Received: from magic.adaptec.com (magic.adaptec.com [208.236.45.80]) by mx1.FreeBSD.org (Postfix) with ESMTP id BFECE43F3F; Tue, 18 Feb 2003 20:44:35 -0800 (PST) (envelope-from scott_long@btc.adaptec.com) Received: from redfish.adaptec.com (redfish.adaptec.com [162.62.50.11]) by magic.adaptec.com (8.11.6+Sun/8.11.6) with ESMTP id h1J4iZD00307; Tue, 18 Feb 2003 20:44:35 -0800 (PST) Received: from btc.btc.adaptec.com (btc.btc.adaptec.com [10.100.0.52]) by redfish.adaptec.com (8.8.8+Sun/8.8.8) with ESMTP id UAA27146; Tue, 18 Feb 2003 20:44:24 -0800 (PST) Received: from btc.adaptec.com (hollin [10.100.253.56]) by btc.btc.adaptec.com (8.8.8+Sun/8.8.8) with ESMTP id VAA06903; Tue, 18 Feb 2003 21:44:20 -0700 (MST) Message-ID: <3E530BA1.8040407@btc.adaptec.com> Date: Tue, 18 Feb 2003 21:44:17 -0700 From: Scott Long User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.2.1) Gecko/20030206 X-Accept-Language: en-us, en MIME-Version: 1.0 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]] Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > 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