public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Pierre Peiffer <Pierre.Peiffer@bull.net>
Cc: Nadia.Derbey@bull.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] IPC: fix error case when idr-cache is empty in ipcget()
Date: Mon, 15 Oct 2007 13:13:10 -0700	[thread overview]
Message-ID: <20071015131310.fa519705.akpm@linux-foundation.org> (raw)
In-Reply-To: <20071011093222.5600520c.Pierre.Peiffer@bull.net>

On Thu, 11 Oct 2007 09:32:22 +0200
Pierre Peiffer <Pierre.Peiffer@bull.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.


  reply	other threads:[~2007-10-15 20:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-11  7:32 [PATCH] IPC: fix error case when idr-cache is empty in ipcget() Pierre Peiffer
2007-10-15 20:13 ` Andrew Morton [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-10-10  9:46 Pierre Peiffer
2007-10-11  6:58 ` Nadia Derbey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071015131310.fa519705.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=Nadia.Derbey@bull.net \
    --cc=Pierre.Peiffer@bull.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox