[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <485F07E4.4020400@gmail.com>
Date: Mon, 23 Jun 2008 11:18:12 +0900
From: Tejun Heo <htejun@...il.com>
To: Benjamin Thery <benjamin.thery@...l.net>
CC: Greg Kroah-Hartman <gregkh@...e.de>,
Andrew Morton <akpm@...ux-foundation.org>,
Eric Biederman <ebiederm@...ssion.com>,
Daniel Lezcano <dlezcano@...ibm.com>,
Serge Hallyn <serue@...ibm.com>, linux-kernel@...r.kernel.org,
Al Viro <viro@....linux.org.uk>,
Linux Containers <containers@...ts.osdl.org>
Subject: Re: [PATCH 10/11] netns: Enable tagging for net_class directories
in sysfs
Benjamin Thery wrote:
> --- linux-mm.orig/fs/sysfs/mount.c
> +++ linux-mm/fs/sysfs/mount.c
> @@ -16,6 +16,8 @@
> #include <linux/mount.h>
> #include <linux/pagemap.h>
> #include <linux/init.h>
> +#include <linux/nsproxy.h>
> +#include <net/net_namespace.h>
>
> #include "sysfs.h"
>
> @@ -78,6 +80,7 @@ static int sysfs_fill_super(struct super
> root->d_sb = sb;
> sb->s_root = root;
> sb->s_fs_info = info;
> + info->tag.net_ns = hold_net(current->nsproxy->net_ns);
> return 0;
>
> out_err:
> @@ -95,6 +98,9 @@ static int sysfs_test_super(struct super
> struct sysfs_super_info *info = sysfs_info(sb);
> int found = 1;
>
> + if (task->nsproxy->net_ns != info->tag.net_ns)
> + found = 0;
> +
> return found;
> }
>
> @@ -131,6 +137,8 @@ static void sysfs_kill_sb(struct super_b
> struct sysfs_super_info *info = sysfs_info(sb);
>
> kill_anon_super(sb);
> + if (info->tag.net_ns)
> + release_net(info->tag.net_ns);
> kfree(info);
> }
Ouch... Please don't hard code net_ns functions directly from sysfs.
Please make a proper abstraction for ns, make net_ns register it and
sysfs test the abstract ns.
Thanks.
--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists