From owner-freebsd-arch Tue Sep 17 7:28:48 2002 Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7A98937B401 for ; Tue, 17 Sep 2002 07:28:46 -0700 (PDT) Received: from albatross.prod.itd.earthlink.net (albatross.mail.pas.earthlink.net [207.217.120.120]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1598243E3B for ; Tue, 17 Sep 2002 07:28:46 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from pool0243.cvx22-bradley.dialup.earthlink.net ([209.179.198.243] helo=mindspring.com) by albatross.prod.itd.earthlink.net with esmtp (Exim 3.33 #1) id 17rJLC-0004BN-00; Tue, 17 Sep 2002 07:28:38 -0700 Message-ID: <3D873BD7.35610322@mindspring.com> Date: Tue, 17 Sep 2002 07:27:35 -0700 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Don Lewis Cc: arch@FreeBSD.org, Ian Dowse Subject: Re: VOP_INACTIVE() References: <200209171031.g8HAV5wr015790@gw.catspoiler.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Don Lewis wrote: > The first fix is to set a flag on the vnode to indicate that > VOP_INACTIVE() is playing with the vnode, so the vnode should not be > reused even though its reference count is zero. This is what used to happen; the flag was V_LOCK (or something like that). There were a couple of instances of inversion in its use, and it was hard to keep straight. > The second fix is to all VOP_INACTIVE() before the reference count is > decremented. The main problem with this is that some of the things done > in the various filesystem inactive methods may depend strongly on the > reference count being zero. One example is the call to vrecycle() in > ufs_inactive(). > > A third fix would be to split VOP_INACTIVE() into two parts, one which > is called to do any I/O before the reference count is decremented, and > the other which does any filesystem specific cleanup after the reference > count is decremented. > > Opinions? I do not like the third option. The logical thing to do would be to not assume anything about the reference count, and that VOP_INACTIVE() *means* VOP_INACTIVE(). This is a modification of the second option. Obviously, you do not want to drop the reference in the higher level code, until you are certain the the reference has been dropped by the lower level code. The real issue here is that the VOP_INACTIVE() is a "give the vnode back to the system" operation, and gives proxy ownership of the vnode the the VFS. This is right. What's wrong is that the vnode that comes out does not have a reference which is owned by the VFS. If this is corrected, you can call VOP_INACTIVE(), and expect that the reference count will be decremented, and that ownership of the vnode will *not* necessarily pass back to the system. The way this works is to set up a reference count management via procedure call, making this a procedural interface. This would be a system function (e.g.: "grab a vnode, get a vnode with a reference count of one back, dispose a vnode of reference count 1, and have the 1->0 transition free the vnode back to the system). For this to really work, open instances need to be references... and directory cache instances *also* need t be references. This is easier, if you think of vnode ownership being with the file system, instead of with the OS, and that the OS-wide pool is really nothing more than a memory manager implementation detail for the vnode structure allocation and free. The TFS vnode references are a good example for this, if they are still around, because in the TFS code, the vnode *was* owned and managed by the VFS (the same would be true for any vnodes for binary SVR4 or other VFS modules that were run in a FreeBSD environment, FWIW). -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message