From patchwork Thu May 21 10:30:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alban Crequy X-Patchwork-Id: 6453741 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id F04219F1CC for ; Thu, 21 May 2015 10:31:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0C69220450 for ; Thu, 21 May 2015 10:31:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C53A72044C for ; Thu, 21 May 2015 10:31:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754504AbbEUKbs (ORCPT ); Thu, 21 May 2015 06:31:48 -0400 Received: from mail-wg0-f48.google.com ([74.125.82.48]:34315 "EHLO mail-wg0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753081AbbEUKbo (ORCPT ); Thu, 21 May 2015 06:31:44 -0400 Received: by wghq2 with SMTP id q2so80934228wgh.1; Thu, 21 May 2015 03:31:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=Q1VJ66Y8ycYO/9tH53ijAH19m4FkApJPTSP6hy7sjOI=; b=aqJefN27sXF+Ft8kIRCgEJwbAw4cJJLC5c14UEvd+Yo9vnfqSLVbJ9g7C0Kkf1ilGO 5H5BV2LAPiauMmeamxL/o6JW4ZfaX/XiQ3pgmVXzHyyAZpRDcULmDbvciu+BjN5SVPng jk0ct/dvURVzq4MCxMiHsjoDzY38VWJn9ONjLDWZy5pKj3Me+fM0Ztw6j4MPvzyeNDkm vbak61UVGcmmM4rvlXf51qCXERzhsqn4O7cM8nio2xJuMJmDP1lkeS3q418be+Oi7Ef/ +ev5vbLdUHkKjL9csVUvuRSWfImObYq95zjSUYnELJGTvGWb1NVF6ZofhGs7Dg03a8rx q3Og== X-Received: by 10.180.84.168 with SMTP id a8mr51299060wiz.40.1432204302462; Thu, 21 May 2015 03:31:42 -0700 (PDT) Received: from alban.primacom.net ([92.206.51.76]) by mx.google.com with ESMTPSA id hn7sm1940665wib.5.2015.05.21.03.31.41 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 21 May 2015 03:31:41 -0700 (PDT) From: Alban Crequy X-Google-Original-From: Alban Crequy To: Cyrill Gorcunov Cc: Oleg Nesterov , Kees Cook , Pavel Emelyanov , Serge Hallyn , KAMEZAWA Hiroyuki , linux-api@vger.kernel.org, Alexander Viro , linux-fsdevel@vger.kernel.org, Andrew Morton , Alban Crequy , Iago Lopez Galeiras Subject: [PATCH] [RFC] fs, proc: don't guard /proc//task//children on CONFIG_CHECKPOINT_RESTORE Date: Thu, 21 May 2015 12:30:21 +0200 Message-Id: <1432204221-1933-1-git-send-email-alban@endocode.com> X-Mailer: git-send-email 2.1.4 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Alban Crequy commit 818411616baf ("fs, proc: introduce /proc//task//children entry") introduced the children entry for checkpoint restore and the file is only available on kernels configured with CONFIG_EXPERT and CONFIG_CHECKPOINT_RESTORE. This is available in most distributions (Fedora, Debian, Ubuntu, CoreOS) because they usually enable CONFIG_EXPERT and CONFIG_CHECKPOINT_RESTORE. But Arch does not enable CONFIG_EXPERT or CONFIG_CHECKPOINT_RESTORE. However, the children proc file is useful outside of checkpoint restore. I would like to use it in rkt. The rkt process exec() another program it does not control, and that other program will fork()+exec() a child process. I would like to find the pid of the child process from an external tool without iterating in /proc over all processes to find which one has a parent pid equal to rkt. Since the children proc file is useful outside of checkpoint-restore, I am removing the guard on CONFIG_CHECKPOINT_RESTORE. Signed-off-by: Alban Crequy Cc: Iago Lopez Galeiras --- fs/proc/array.c | 2 -- fs/proc/base.c | 2 -- 2 files changed, 4 deletions(-) diff --git a/fs/proc/array.c b/fs/proc/array.c index fd02a9e..6edec57 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c @@ -569,7 +569,6 @@ int proc_pid_statm(struct seq_file *m, struct pid_namespace *ns, return 0; } -#ifdef CONFIG_CHECKPOINT_RESTORE static struct pid * get_children_pid(struct inode *inode, struct pid *pid_prev, loff_t pos) { @@ -692,4 +691,3 @@ const struct file_operations proc_tid_children_operations = { .llseek = seq_lseek, .release = children_seq_release, }; -#endif /* CONFIG_CHECKPOINT_RESTORE */ diff --git a/fs/proc/base.c b/fs/proc/base.c index 093ca14..b743007 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -2922,9 +2922,7 @@ static const struct pid_entry tid_base_stuff[] = { ONE("stat", S_IRUGO, proc_tid_stat), ONE("statm", S_IRUGO, proc_pid_statm), REG("maps", S_IRUGO, proc_tid_maps_operations), -#ifdef CONFIG_CHECKPOINT_RESTORE REG("children", S_IRUGO, proc_tid_children_operations), -#endif #ifdef CONFIG_NUMA REG("numa_maps", S_IRUGO, proc_tid_numa_maps_operations), #endif