From patchwork Sat Jul 11 16:13:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Eric W. Biederman" X-Patchwork-Id: 6771111 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3E730C05AC for ; Sat, 11 Jul 2015 16:18:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 54B922066C for ; Sat, 11 Jul 2015 16:18:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DCF3D2060B for ; Sat, 11 Jul 2015 16:18:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751193AbbGKQSv (ORCPT ); Sat, 11 Jul 2015 12:18:51 -0400 Received: from out03.mta.xmission.com ([166.70.13.233]:59973 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751132AbbGKQSu (ORCPT ); Sat, 11 Jul 2015 12:18:50 -0400 Received: from in02.mta.xmission.com ([166.70.13.52]) by out03.mta.xmission.com with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1ZDxUH-00078e-KF; Sat, 11 Jul 2015 10:18:49 -0600 Received: from 67-3-205-90.omah.qwest.net ([67.3.205.90] helo=x220.int.ebiederm.org.xmission.com) by in02.mta.xmission.com with esmtpsa (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1ZDxUG-0007CU-TA; Sat, 11 Jul 2015 10:18:49 -0600 From: ebiederm@xmission.com (Eric W. Biederman) To: Linux Containers Cc: Date: Sat, 11 Jul 2015 11:13:12 -0500 Message-ID: <87pp3ypt9j.fsf@x220.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 X-XM-AID: U2FsdGVkX1+iVZHN/l+A1np9n2Agv0LpZLoqjln1YVE= X-SA-Exim-Connect-IP: 67.3.205.90 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-DCC: XMission; sa02 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: **;Linux Containers X-Spam-Relay-Country: X-Spam-Timing: total 361 ms - load_scoreonly_sql: 0.05 (0.0%), signal_user_changed: 3.7 (1.0%), b_tie_ro: 2.6 (0.7%), parse: 1.03 (0.3%), extract_message_metadata: 24 (6.6%), get_uri_detail_list: 1.70 (0.5%), tests_pri_-1000: 9 (2.5%), tests_pri_-950: 2.1 (0.6%), tests_pri_-900: 1.63 (0.5%), tests_pri_-400: 24 (6.5%), check_bayes: 22 (6.0%), b_tokenize: 8 (2.1%), b_tok_get_all: 6 (1.6%), b_comp_prob: 2.8 (0.8%), b_tok_touch_all: 2.5 (0.7%), b_finish: 0.88 (0.2%), tests_pri_0: 284 (78.6%), tests_pri_500: 8 (2.1%), rewrite_mail: 0.00 (0.0%) Subject: [REVIEW][PATCH] nsfs: Add a show_path method to fix mountinfo X-SA-Exim-Version: 4.2.1 (built Wed, 24 Sep 2014 11:00:52 -0600) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Today mountinfo displays a very unhelpful "/" for nsfs files. Add a show_path method returning the same string as ns_dname. This results in a bind mount of /proc//ns/net showing up in /proc//mountinfo as "net:[1234...]" instead of "/". Signed-off-by: "Eric W. Biederman" --- fs/nsfs.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fs/nsfs.c b/fs/nsfs.c index 99521e7c492b..e4905fbf3396 100644 --- a/fs/nsfs.c +++ b/fs/nsfs.c @@ -4,6 +4,7 @@ #include #include #include +#include static struct vfsmount *nsfs_mnt; @@ -136,9 +137,18 @@ out_invalid: return ERR_PTR(-EINVAL); } +static int nsfs_show_path(struct seq_file *seq, struct dentry *dentry) +{ + struct inode *inode = d_inode(dentry); + const struct proc_ns_operations *ns_ops = dentry->d_fsdata; + + return seq_printf(seq, "%s:[%lu]", ns_ops->name, inode->i_ino); +} + static const struct super_operations nsfs_ops = { .statfs = simple_statfs, .evict_inode = nsfs_evict, + .show_path = nsfs_show_path, }; static struct dentry *nsfs_mount(struct file_system_type *fs_type, int flags, const char *dev_name, void *data)