From mboxrd@z Thu Jan 1 00:00:00 1970 From: Oren Laadan Subject: Re: [RFC][PATCH 0/4] Object creation with a specified id Date: Tue, 15 Apr 2008 14:52:33 -0400 Message-ID: <4804F971.3020207@cs.columbia.edu> References: <20080404145129.637145000@bull.net> <20080415030623.GA8171@tull.net> <480483C2.3030509@bull.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <480483C2.3030509-6ktuUTfB/bM@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Nadia Derbey Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, Nick Andrew , linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: containers.vger.kernel.org Nadia Derbey wrote: > Nick Andrew wrote: >> On Fri, Apr 04, 2008 at 04:51:29PM +0200, Nadia.Derbey-6ktuUTfB/bM@public.gmane.org wrote: >> >>> . echo "LONG XX" > /proc/self/next_id >>> next object to be created will have an id set to XX >>> . echo "LONG X0 ... X" > /proc/self/next_id >>> next object to be created will have its ids set to XX0, ... X >>> This is particularly useful for processes that may have several >>> ids if >>> they belong to nested namespaces. >> >> >> How do you handle race conditions, i.e. you specify the ID for the >> next object to be created, and then some other thread goes and creates >> an object before your thread creates one? >> >> Nick. > > > Sorry for not answering earlier, I just saw your e-mail! [I too managed to miss that message]. > > It's true that the way I've done things, the "create_with_id" doesn't > take into account multi-threaded apps, since "self" is related to the > thread group leader. > > May be using something like /proc/self/task//next_id would be > better, but I have to think more about it... That /proc/self links to /proc/TGID slipped my mind. Definitely must be done on a per-thread basis (and /proc//task//next_id will do the trick). Oren. > > Regards, > Nadia From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758684AbYDOSyS (ORCPT ); Tue, 15 Apr 2008 14:54:18 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752421AbYDOSyI (ORCPT ); Tue, 15 Apr 2008 14:54:08 -0400 Received: from jalapeno.cc.columbia.edu ([128.59.29.5]:52713 "EHLO jalapeno.cc.columbia.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752270AbYDOSyH (ORCPT ); Tue, 15 Apr 2008 14:54:07 -0400 Message-ID: <4804F971.3020207@cs.columbia.edu> Date: Tue, 15 Apr 2008 14:52:33 -0400 From: Oren Laadan Organization: Columbia University User-Agent: Thunderbird 2.0.0.12 (X11/20080213) MIME-Version: 1.0 To: Nadia Derbey CC: Nick Andrew , linux-kernel@vger.kernel.org, containers@lists.linux-foundation.org Subject: Re: [RFC][PATCH 0/4] Object creation with a specified id References: <20080404145129.637145000@bull.net> <20080415030623.GA8171@tull.net> <480483C2.3030509@bull.net> In-Reply-To: <480483C2.3030509@bull.net> X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-No-Spam-Score: Local Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Nadia Derbey wrote: > Nick Andrew wrote: >> On Fri, Apr 04, 2008 at 04:51:29PM +0200, Nadia.Derbey@bull.net wrote: >> >>> . echo "LONG XX" > /proc/self/next_id >>> next object to be created will have an id set to XX >>> . echo "LONG X0 ... X" > /proc/self/next_id >>> next object to be created will have its ids set to XX0, ... X >>> This is particularly useful for processes that may have several >>> ids if >>> they belong to nested namespaces. >> >> >> How do you handle race conditions, i.e. you specify the ID for the >> next object to be created, and then some other thread goes and creates >> an object before your thread creates one? >> >> Nick. > > > Sorry for not answering earlier, I just saw your e-mail! [I too managed to miss that message]. > > It's true that the way I've done things, the "create_with_id" doesn't > take into account multi-threaded apps, since "self" is related to the > thread group leader. > > May be using something like /proc/self/task//next_id would be > better, but I have to think more about it... That /proc/self links to /proc/TGID slipped my mind. Definitely must be done on a per-thread basis (and /proc//task//next_id will do the trick). Oren. > > Regards, > Nadia