From owner-freebsd-fs@FreeBSD.ORG Wed May 18 20:37:40 2011 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 CEF02106566B for ; Wed, 18 May 2011 20:37:40 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from esa-annu.mail.uoguelph.ca (esa-annu.mail.uoguelph.ca [131.104.91.36]) by mx1.freebsd.org (Postfix) with ESMTP id 911C98FC14 for ; Wed, 18 May 2011 20:37:40 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApwEAM8s1E2DaFvO/2dsb2JhbACEWaI6iHCtB5B9gSuBbIF7gQcEkBGHK4dm X-IronPort-AV: E=Sophos;i="4.65,233,1304308800"; d="scan'208";a="121148675" Received: from erie.cs.uoguelph.ca (HELO zcs3.mail.uoguelph.ca) ([131.104.91.206]) by esa-annu-pri.mail.uoguelph.ca with ESMTP; 18 May 2011 16:37:39 -0400 Received: from zcs3.mail.uoguelph.ca (localhost.localdomain [127.0.0.1]) by zcs3.mail.uoguelph.ca (Postfix) with ESMTP id 79361B3F53; Wed, 18 May 2011 16:37:39 -0400 (EDT) Date: Wed, 18 May 2011 16:37:39 -0400 (EDT) From: Rick Macklem To: FreeBSD FS Message-ID: <5718691.545130.1305751059426.JavaMail.root@erie.cs.uoguelph.ca> In-Reply-To: <20110517092011.GK48734@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [172.17.91.201] X-Mailer: Zimbra 6.0.10_GA_2692 (ZimbraWebClient - FF3.0 (Win)/6.0.10_GA_2692) Cc: Subject: Re: RFC: adding a lock flags argument to VFS_FHTOVP() for FreeBSD9 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, 18 May 2011 20:37:40 -0000 > Yes, the flag to specify the locking mode does only specify the > minimal > locking requirements, and filesystem is allowed to upgrade it to the > more strict lock type. E.g. UFS would only return shared lock if the > vnode was found in hash, AFAIR. If not told otherwise, getnewvnode(9) > forces lockmgr to convert all lock requests into exclusive. > That's exactly what UFS does, but I did notice some inconsistencies w.r.t. the various file systems. For VFS_VGET(), ffs/cd9660/udf do basically the following: 1 error = vfs_hash_get(mp, ino, flags, curthread, vpp, NULL, NULL); ... 2 if ((flags & LK_TYPE_MASK) == LK_SHARED) { flags &= ~LK_TYPE_MASK; flags |= LK_EXCLUSIVE; } ... 3 lockmgr(vp->v_vnlock, LK_EXCLUSIVE, NULL); ... 4 error = vfs_hash_insert(vp, ino, flags, curthread, vpp, NULL, NULL); but hpfs/ext2fs do something similar to the above, except they omit step #2. (ie. They would do #4 with LK_SHARED, if that was what flags is passed in as.) Looking at vfs_hash_insert(), the "flags" argument is just used for vget(), so it isn't obvious to me if it needs to be LK_EXCLUSIVE or not. So, does anyone know if this depend on the file system or are hpfs/ext2fs broken? Thanks in advance for any help with this, rick ps: Fortunately, for my patch, I can just ignore the "flags" argument for VFS_FHTOVP() for the file systems I'm not sure about, so they'll just return LK_EXCLUSIVE locked vnodes.