From owner-freebsd-fs Wed Aug 7 18: 7:57 2002 Delivered-To: freebsd-fs@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C98C437B400 for ; Wed, 7 Aug 2002 18:07:54 -0700 (PDT) Received: from falcon.mail.pas.earthlink.net (falcon.mail.pas.earthlink.net [207.217.120.74]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6717E43E42 for ; Wed, 7 Aug 2002 18:07:54 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from pool0264.cvx22-bradley.dialup.earthlink.net ([209.179.199.9] helo=mindspring.com) by falcon.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) id 17cbmC-0005Uz-00; Wed, 07 Aug 2002 18:07:44 -0700 Message-ID: <3D51C42B.8C406A60@mindspring.com> Date: Wed, 07 Aug 2002 18:06:51 -0700 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Rashim Gupta Cc: "David E. Cross" , fs@freebsd.org Subject: Re: vnodes (UFS journaling)? References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-fs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Rashim Gupta wrote: > we are trying to implement a logging facility for the File System. Hence > we need to open the log file and keep its vnode open throughout the > duration while the system is mounted. Hence, we cannot free the vnode > after searching for it using the root file system since we need to access > it later on. However, if we do not > return the vnode, then doing an "ls -al" in the dirctory where the log > file is present hangs the kernel. > > Any suggestions how we can solve this problem. AHA! It was confusing because David kept referencing that this was a journalling FS, not a project to just do metadata logging ala ReiserFS. You are trying to do this the wrong way. Ideally, you would not be using a log file which was a *file*. However... You can still use a file for this, on the FS, but it's a moderately ugly thing to do it by vnode (if you put the log file on another FS, you can get an undetectable deadly embrace deadlock as a result of mutual locking). The code you want to look at for an example that does what you want to do is in /usr/src/sys/ufs/ufs/ufs_quota.c. Specifically, look at the quotaon(), quotaoff(), aysync(), dqget(), dqsync(), and dqrele() code. Note that the vnode references in um_quotas[] are held in the in core mount structure, and do not interfere with the ability to deal with the "ls" case you are worried about, because the references are held... but not locked at the time an "ls" occurs. -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-fs" in the body of the message