Re: [NFS] RE: [autofs] multiple servers per automount

From: Ingo Oeser
Date: Wed Oct 15 2003 - 05:33:11 EST


On Wednesday 15 October 2003 01:12, Mike Waychison wrote:
> The problem still remains in 2.6 that we limit the count to 256. I've
> attached a quick patch that I've compiled and tested. I don't know if
> there is a better way to handle dynamic assignment of minors (haven't
> kept up to date in that realm), but if there is, then we should probably
> use it instead.


In your patch you allocate inside the spinlock.

I would suggest to do sth. like the following:

void *local;
if (!unamed_dev_inuse) {
local = get_zeroed_page(GFP_KERNEL);

if (!local)
return -ENOMEM;
}

spinlock(&unamed_dev_lock);
mb();
if (!unamed_dev_inuse) {
unamed_dev_inuse = local;

/* Used globally, don't free now */
local = NULL;
}

/*
Do the lookup and alloc
*/

spinunlock(&unamed_dev_lock);

/* Free page, because of race on allocation. */
if (local)
free_page(local);


Which will swap the pointers atomically and still alloc outside the
non-sleeping locking.


Regards

Ingo Oeser


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