From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sunil Mushran Subject: Re: [PATCH 3/4] XFS: Return case-insensitive match for dentry cache Date: Tue, 20 May 2008 13:50:03 -0700 Message-ID: <4833397B.2000109@oracle.com> References: <20080513075749.477238845@chook.melbourne.sgi.com> <20080513080152.911303131@chook.melbourne.sgi.com> <20080513085724.GC21919@infradead.org> <20080515045700.GA4328@infradead.org> <20080520182315.GA8456@infradead.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Cc: Barry Naujok , Anton Altaparmakov , xfs@oss.sgi.com, linux-fsdevel To: Christoph Hellwig Return-path: Received: from agminet01.oracle.com ([141.146.126.228]:53807 "EHLO agminet01.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756867AbYETUuO (ORCPT ); Tue, 20 May 2008 16:50:14 -0400 In-Reply-To: <20080520182315.GA8456@infradead.org> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Christoph Hellwig wrote: > The cond_resched_lock here is not safe here, because the pointer you > are going to dereference in list_for_each_entry might not be valid > anymore. This should look more like: > > void d_drop_negative_children(struct dentry *parent) > { > struct dentry *dentry; > > again: > spin_lock(&dcache_lock); > list_for_each_entry(dentry, &parent->d_subdirs, d_u.d_child) { > if !(dentry->d_inode) > continue; > > spin_lock(&dentry->d_lock); > __d_drop(dentry); > spin_unlock(&dentry->d_lock); > > if (need_resched()) { > spin_unlock(&dcache_lock); > cond_resched(); > goto again; > } > } > spin_unlock(&dcache_lock); > } > Yes, we have been bitten by the same issue. Instead of need_resched(), it may be better if you do: if (cond_resched_lock(&dcache_lock)) goto again;