From owner-freebsd-fs@FreeBSD.ORG Wed Oct 17 22:27:32 2007 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F3A3116A418 for ; Wed, 17 Oct 2007 22:27:31 +0000 (UTC) (envelope-from lulf@stud.ntnu.no) Received: from signal.itea.ntnu.no (signal.itea.ntnu.no [129.241.190.231]) by mx1.freebsd.org (Postfix) with ESMTP id B718113C459 for ; Wed, 17 Oct 2007 22:27:30 +0000 (UTC) (envelope-from lulf@stud.ntnu.no) Received: from localhost (localhost [127.0.0.1]) by signal.itea.ntnu.no (Postfix) with ESMTP id 955E534486 for ; Thu, 18 Oct 2007 00:09:40 +0200 (CEST) Received: from caracal.stud.ntnu.no (caracal.stud.ntnu.no [129.241.56.185]) by signal.itea.ntnu.no (Postfix) with ESMTP for ; Thu, 18 Oct 2007 00:09:40 +0200 (CEST) Received: by caracal.stud.ntnu.no (Postfix, from userid 2312) id 3C4EE6240FD; Thu, 18 Oct 2007 00:09:48 +0200 (CEST) Date: Thu, 18 Oct 2007 00:09:48 +0200 From: Ulf Lilleengen To: freebsd-fs@freebsd.org Message-ID: <20071017220948.GA4279@stud.ntnu.no> References: <20070816100526.GA31897@stud.ntnu.no> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070816100526.GA31897@stud.ntnu.no> User-Agent: Mutt/1.5.9i X-Content-Scanned: with sophos and spamassassin at mailgw.ntnu.no. Subject: Re: [PATCH] Make fdescfs MPSAFE X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Oct 2007 22:27:32 -0000 On tor, aug 16, 2007 at 12:05:26 +0200, Ulf Lilleengen wrote: > Hi, > > To be able to better understand VFS and locking in general, I started making > fdescfs MPSAFE. I'm not experienced with any of these things, so there might be > some errors, although I've looked through much VFS code and code for other FS > like nullfs. I've tested it by running two pthreads on the same fd, and that seamt > to work, but there might be other cases where it will fail. > > Patch is attached. > Attached is a new patch that uses rwlocks instead of mutexes (since reading the hash_table is frequently done). Also, it adds checking so that there is no duplicates in the hash table before inserting the new fdescnode. And add a mising hashfree(). I also checked to see if there was any issues regarding Jeffs new patch to use atomic operations on the file structure, but there wasn't any obvious places where this affects fdescfs. Patch here: http://folk.ntnu.no/lulf/patches/freebsd/fdescfs/fdescfs_lock.diff -- Ulf Lilleengen