From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paul Menage Subject: Re: [PATCH] use list_* functions better in dcache.c Date: Wed, 03 Jul 2002 11:04:21 -0700 Sender: linux-fsdevel-owner@vger.kernel.org Message-ID: References: <20020703170211.N27706@parcelfarce.linux.theplanet.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Return-path: To: Matthew Wilcox cc: pmenage@ensim.com In-Reply-To: Your message of "Wed, 03 Jul 2002 17:02:11 BST." <20020703170211.N27706@parcelfarce.linux.theplanet.co.uk> List-Id: linux-fsdevel.vger.kernel.org >@@ -382,42 +389,18 @@ void prune_dcache(int count) > > void shrink_dcache_sb(struct super_block * sb) > { >- struct list_head *tmp, *next; >- struct dentry *dentry; >- >- /* >- * Pass one ... move the dentries for the specified >- * superblock to the most recent end of the unused list. >- */ >- spin_lock(&dcache_lock); Oops - you're walking dentry_unused without holding dcache_lock ... >- next = dentry_unused.next; >- while (next != &dentry_unused) { >- tmp = next; >- next = tmp->next; >- dentry = list_entry(tmp, struct dentry, d_lru); >- if (dentry->d_sb != sb) >- continue; >- list_del(tmp); >- list_add(tmp, &dentry_unused); >- } >- >- /* >- * Pass two ... free the dentries for this superblock. >- */ >-repeat: >- next = dentry_unused.next; >- while (next != &dentry_unused) { >- tmp = next; >- next = tmp->next; >- dentry = list_entry(tmp, struct dentry, d_lru); >+ struct list_head *entry, *next; >+ >+ list_for_each_safe(entry, next, &dentry_unused) { >+ struct dentry *dentry = list_entry(entry, struct dentry, d_lru); > if (dentry->d_sb != sb)