[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20071015131310.fa519705.akpm@linux-foundation.org>
Date: Mon, 15 Oct 2007 13:13:10 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Pierre Peiffer <Pierre.Peiffer@...l.net>
Cc: Nadia.Derbey@...l.net, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] IPC: fix error case when idr-cache is empty in ipcget()
On Thu, 11 Oct 2007 09:32:22 +0200
Pierre Peiffer <Pierre.Peiffer@...l.net> wrote:
> @@ -373,7 +376,7 @@ int ipcget_public(struct ipc_namespace *
> struct kern_ipc_perm *ipcp;
> int flg = params->flg;
> int err;
> -
> +retry:
> err = idr_pre_get(&ids->ipcs_idr, GFP_KERNEL);
>
> mutex_lock(&ids->mutex);
> @@ -406,6 +409,9 @@ int ipcget_public(struct ipc_namespace *
> }
> mutex_unlock(&ids->mutex);
>
> + if (err == -EAGAIN)
> + goto retry;
> +
> return err;
> }
Not pretty, is it? The idr interface isn't a good one. But then, any
storage library (aka container class) which allocates memory at insertion
time is a pain to handle in the kernel.
btw, idr_pre_get() should return 0 on success, else an errno - the current
interface is silly.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists