Re: [PATCH] slub: Fix sysfs circular locking dependency

From: David Rientjes
Date: Tue Jan 04 2011 - 22:44:50 EST


On Tue, 4 Jan 2011, Pekka Enberg wrote:

> diff --git a/mm/slub.c b/mm/slub.c
> index bec0e35..9831004 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -2516,7 +2516,13 @@ void kmem_cache_destroy(struct kmem_cache *s)
> }
> if (s->flags & SLAB_DESTROY_BY_RCU)
> rcu_barrier();
> + /*
> + * The locking order is (1) sysfs internal locks and (2)
> + * slub_lock so drop the latter to avoid a deadlock.
> + */
> + up_write(&slub_lock);
> sysfs_slab_remove(s);
> + return;
> }
> up_write(&slub_lock);
> }

slub_lock protects slab_state following kmem_cache_init() if caches are
created/destroyed prior to the sysfs slab initcall setting the global
variable, so couldn't this leak the kobject if its initialization and add
was deferred on kmem_cache_create() and added by slab_sysfs_init()?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/