Messages in this thread |  | | From | Paul Menage <> | | Subject | Re: [PATCH] use list_* functions better in dcache.c | | Date | Wed, 03 Jul 2002 11:04:21 -0700 |
| |
>@@ -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)
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|  |