Re: [PATCH] IPC: fix error case when idr-cache is empty in ipcget()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 11 Oct 2007 09:32:22 +0200
Pierre Peiffer <[email protected]> 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux