Re: [PATCH] use list_* functions better in dcache.c

From: Paul Menage (pmenage@ensim.com)
Date: Wed Jul 03 2002 - 13:04:21 EST


>@@ -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/



This archive was generated by hypermail 2b29 : Sun Jul 07 2002 - 22:00:11 EST