Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965703AbaFTJOh (ORCPT ); Fri, 20 Jun 2014 05:14:37 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:40464 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1753858AbaFTJOe (ORCPT ); Fri, 20 Jun 2014 05:14:34 -0400 X-IronPort-AV: E=Sophos;i="5.00,743,1396972800"; d="scan'208";a="32193642" From: "chenhanxiao@cn.fujitsu.com" To: Oleg Nesterov CC: "containers@lists.linux-foundation.org" , "linux-kernel@vger.kernel.org" , Andrew Morton , "Eric W. Biederman" , Serge Hallyn , "Daniel P. Berrange" , "Al Viro" , David Howells , "Richard Weinberger" , Pavel Emelyanov , Vasiliy Kulikov , "Gotou, Yasunori" Subject: RE: [PATCH] ns: introduce getnspid syscall Thread-Topic: [PATCH] ns: introduce getnspid syscall Thread-Index: AQHPix8FyYYtVdOGlkGmf8xJuFfmRZt5uGCg Date: Fri, 20 Jun 2014 09:14:31 +0000 Message-ID: <5871495633F38949900D2BF2DC04883E54B4DA@G08CNEXMBPEKD02.g08.fujitsu.local> References: <1403000496-10094-1-git-send-email-chenhanxiao@cn.fujitsu.com> <20140618175807.GA21565@redhat.com> In-Reply-To: <20140618175807.GA21565@redhat.com> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.167.226.240] Content-Type: text/plain; charset="gb2312" MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id s5K9EhcQ032357 > -----Original Message----- > From: Oleg Nesterov [mailto:oleg@redhat.com] > Sent: Thursday, June 19, 2014 1:58 AM > To: Chen, Hanxiao/?? ???? > Cc: containers@lists.linux-foundation.org; linux-kernel@vger.kernel.org; > Andrew Morton; Eric W. Biederman; Serge Hallyn; Daniel P. Berrange; Al Viro; David > Howells; Richard Weinberger; Pavel Emelyanov; Vasiliy Kulikov; Gotou, Yasunori/ > ???u ???? > Subject: Re: [PATCH] ns: introduce getnspid syscall > > On 06/17, Chen Hanxiao wrote: > > > > +SYSCALL_DEFINE4(getnspid, pid_t, pid, int, fd1, int, fd2, int, pidtype) > > +{ > > + struct file *file1 = NULL, *file2 = NULL; > > + struct task_struct *task; > > + struct pid_namespace *ns1, *ns2; > > + struct proc_ns *ei; > > + int ret = -1; > > + > > + if (pidtype >= PIDTYPE_MAX) > > + return -EINVAL; > > + > > + file1 = proc_ns_fget(fd1); > > + if (IS_ERR(file1)) > > + return PTR_ERR(file1); > > + ei = get_proc_ns(file_inode(file1)); > > + ns1 = (struct pid_namespace *)ei->ns; > > and I am not sure this part is correct... shouldn't we also verify that > ns_ops == pidns_operations ? > You're right. We should check this part. Thanks, - Chen > Perhaps it makes sense to generalize get_net_ns_by_fd() into > "void *get_ns_by_fd(fd, type)"... this probably needs another "check-and-get" > method in proc_ns_operations(). I dunno. > > Oleg. ????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?