From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Hudec Subject: Re: Some questions about memory allocation and BKL Date: Sun, 26 Oct 2003 15:01:13 +0100 Sender: linux-fsdevel-owner@vger.kernel.org Message-ID: <20031026140113.GL1465@vagabond> References: <20031026124336.GK1465@vagabond> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel Return-path: Received: from cimice4.lam.cz ([212.71.168.94]:39654 "EHLO vagabond.light.src") by vger.kernel.org with ESMTP id S263155AbTJZOBW (ORCPT ); Sun, 26 Oct 2003 09:01:22 -0500 To: Ian Kent Content-Disposition: inline In-Reply-To: List-Id: linux-fsdevel.vger.kernel.org On Sun, Oct 26, 2003 at 21:21:31 +0800, Ian Kent wrote: > On Sun, 26 Oct 2003, Jan Hudec wrote: > > No. It is forbiden to turn dentry to negative one unless you are the > > only holder (it has refcount 1). See d_delete(). > > Sorry, my bad description. I was thinking about if (...) to check > fields which I think, acording to the discussion, is OK but ... inode and name are constant, so don't need lock. all the lists need dcache_lock (subdirs, hash etc...). Parent should need dcache_lock too (try to look it up in rename code). I don't know about mountpoint, but obviously requires some locking. > > You only need to hold the lock when you check whether the dentry is > > hashed. And you need to use the atomic_* functions to access the > > refcount. > > Does that also include tests on a list in the dentry. > I think that you said that this is what needs the lock, correct? > > For example: > > if (!d_mountpoint(dentry) && list_empty(&dentry->d_subdirs)) > ... > > needs the dcache_lock? I assume yes. The tree lists should need dcache_lock. ------------------------------------------------------------------------------- Jan 'Bulb' Hudec