From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Serge E. Hallyn" Subject: Re: [RFC][PATCH] Pid namespaces vs locks interaction Date: Wed, 12 Dec 2007 11:31:15 -0600 Message-ID: <20071212173115.GA21956@sergelap.austin.ibm.com> References: <200712061411.32159.vgusev@openvz.org> <200712061819.59841.vgusev@openvz.org> <20071206155130.GA12463@sergelap.austin.ibm.com> <200712121907.25283.vgusev@openvz.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: "Serge E. Hallyn" , "J. Bruce Fields" , linux-fsdevel@vger.kernel.org, Linux Containers , Pavel Emelyanov To: Vitaliy Gusev Return-path: Received: from e5.ny.us.ibm.com ([32.97.182.145]:40949 "EHLO e5.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756633AbXLLRbS (ORCPT ); Wed, 12 Dec 2007 12:31:18 -0500 Received: from d01relay02.pok.ibm.com (d01relay02.pok.ibm.com [9.56.227.234]) by e5.ny.us.ibm.com (8.13.8/8.13.8) with ESMTP id lBCHVFSb025104 for ; Wed, 12 Dec 2007 12:31:15 -0500 Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay02.pok.ibm.com (8.13.8/8.13.8/NCO v8.7) with ESMTP id lBCHVFKj434962 for ; Wed, 12 Dec 2007 12:31:15 -0500 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id lBCHVEqf002026 for ; Wed, 12 Dec 2007 12:31:15 -0500 Content-Disposition: inline In-Reply-To: <200712121907.25283.vgusev@openvz.org> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Quoting Vitaliy Gusev (vgusev@openvz.org): > Hello > > On 6 December 2007 18:51:30 Serge E. Hallyn wrote: > > > fl_pid is used by nfs, fuse and gfs2. For instance nfs keeps in fl_pid > > > some unique id to identify locking process between hosts - it is not a > > > process pid. > > > > Ok, but so the struct user_flock->fl_pid is being set to the task's > > virtual pid, while the struct kernel_flock->fl_pid is being set to > > task->tgid for nfsd use. > > > > Why can't nfs just generate a uniqueid from the struct pid when it > > needs it? > > I think it is hard. lockd uses struct nlm_host to get process unique id (see > __nlm_alloc_pid() function). Looks pretty simple though... That whole set of code could even stay the same except for in __nlm_alloc_pid(): option 1: compare struct pid* instead of uint32_t pid option 2: use the "global pid" out of the stored struct pid, something like pid->numbers[0].nr. > > Fuse just seems to copy the pid to report it to userspace, so it would > > just copy pid_vnr(kernel_flock->pid) into user_flock->fl_pid. > > > > Anyway I haven't looked at all the uses of struct fl_pid, but you > > can always get the pidnr back from the struct pid if needed so there > > should be no problem. > > > > The split definately seems worthwhile to me, so that > > user_flock->fl_pidnr can always be said to be the pid in the acting > > process' namespace, and flock->fl_pid can always be a struct pid, > > rather than having fl_pid sometimes be current->tgid, or sometimes > > pid_vnr(flock->fl_nspid)... > > > > -serge > > - > > To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in > > the body of a message to majordomo@vger.kernel.org > > More majordomo info at http://vger.kernel.org/majordomo-info.html > > > > -- > Thank, > Vitaliy Gusev