Re: [PATCH 2/3] MEMSTICK: add support for legacy memorysticks

From: Andrew Morton
Date: Mon Sep 20 2010 - 21:18:05 EST


On Mon, 20 Sep 2010 18:16:03 -0700 (PDT) Alex Dubov <oakad@xxxxxxxxx> wrote:

> However, do you have a quick
> advice for a case, were idr_pre_get happens outside spin-locked section,
> as opposed to mutex one?

It sucks, but...

again:
if (idr_pre_get(..., GFP_KERNEL) == NULL)
return -ENOMEM; /* We're really out-of-memory */
spin_lock(lock);
if (idr_get_new(...) == -EAGAIN) {
spin_unlock(lock);
goto again; /* Someone stole our preallocation! */
}
--
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/