* [PATCH 0/5] Better namespace handling for /sys/class/net/bonding_masters
@ 2011-10-13 7:47 Eric W. Biederman
2011-10-13 7:53 ` [PATCH 1/5] sysfs: Implement support for tagged files in sysfs Eric W. Biederman
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: Eric W. Biederman @ 2011-10-13 7:47 UTC (permalink / raw)
To: Greg Kroah-Hartman, David Miller
Cc: linux-kernel, netdev, Tejun Heo, Jay Vosburgh, Andy Gospodarek
When I was looking at another sysfs issue that Al pointed out (since
fixed) I realized that I had implemented a trivial code size but overly
clever way to handle /sys/class/net/bonding_masters.
This patchset removes the support for untagged entries in tagged
directories (that is currently used to support bonding_masters)
and replaces it with support for tagged sysfs attributes.
In the process this fixes a small misfeature in how bonding_masters
derives the network namespace we are dealing with. This change
allows bonding_masters to derive the network namespace from the
copy of bonding_masters we open instead of magically from current.
The final patch of this patchset adds sanity checks to sysfs. To
ensure that we don't accidentally mishandle tagged sysfs entities.
I have tested this code against 3.1-rc9 on my laptop with a mostly yes
config and I am not seeing any problems. The loud screaming warnings I
have added in the last patch should catch any corner cases in how people
use sysfs that I might have overlooked.
Greg, Dave I'm don't know whose tree to merge this through as this code
is equally device-core and networking. I am hoping that we can get this
improvement merged for 3.2.
Farther out the simplifications introduced in this patchset make it much
easier to implement sysfs directories that can scale when there are
enormous numbers of entries in them.
Eric W. Biederman (5):
sysfs: Implement support for tagged files in sysfs.
class: Implement support for class attrs in tagged sysfs directories.
bonding: Use a per netns implementation of /sys/class/net/bonding_masters.
sysfs: Remove support for tagged directories with untagged members.
sysfs: Reject with a warning invalid uses of tagged directories.
---
drivers/base/class.c | 17 ++++++++++-
drivers/net/bonding/bond_main.c | 7 +---
drivers/net/bonding/bond_sysfs.c | 45 +++++++++++++++++++++---------
drivers/net/bonding/bonding.h | 7 +++-
fs/sysfs/dir.c | 20 +++++++++++--
fs/sysfs/file.c | 56 ++++++++++++++++++++++++++++++++++---
fs/sysfs/inode.c | 2 -
include/linux/device.h | 2 +
include/linux/sysfs.h | 1 +
9 files changed, 124 insertions(+), 33 deletions(-)
Eric
^ permalink raw reply [flat|nested] 11+ messages in thread* [PATCH 1/5] sysfs: Implement support for tagged files in sysfs. 2011-10-13 7:47 [PATCH 0/5] Better namespace handling for /sys/class/net/bonding_masters Eric W. Biederman @ 2011-10-13 7:53 ` Eric W. Biederman 2011-10-13 7:55 ` [PATCH 2/5] class: Implement support for class attrs in tagged sysfs directories Eric W. Biederman 2011-10-13 17:25 ` [PATCH 0/5] Better namespace handling for /sys/class/net/bonding_masters Greg KH 2011-10-19 4:09 ` David Miller 2 siblings, 1 reply; 11+ messages in thread From: Eric W. Biederman @ 2011-10-13 7:53 UTC (permalink / raw) To: Greg Kroah-Hartman Cc: David Miller, linux-kernel, netdev, Tejun Heo, Jay Vosburgh, Andy Gospodarek Looking up files in sysfs is hard to understand and analyize because we currently allow placing untagged files in tagged directories. In the implementation of that we have two subtly different meanings of NULL. NULL meaning there is no tag on a directory entry and NULL meaning we don't care which namespace the lookup is performed for. This multiple uses of NULL have resulted in subtle bugs (since fixed) in the code. Currently it is only the bonding driver that needs to have an untagged file in a tagged directory. To untagle this mess I am adding support for tagged files to sysfs. Modifying the bonding driver to implement bonding_masters as a tagged file. Registering bonding_masters once for each network namespace. Then I am removing support for untagged entries in tagged sysfs directories. Resulting in code that is much easier to reason about. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- fs/sysfs/file.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++- include/linux/sysfs.h | 1 + 2 files changed, 52 insertions(+), 2 deletions(-) diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index 1ad8c93..07c1b4e 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c @@ -488,17 +488,56 @@ const struct file_operations sysfs_file_operations = { .poll = sysfs_poll, }; +int sysfs_attr_ns(struct kobject *kobj, const struct attribute *attr, + const void **pns) +{ + struct sysfs_dirent *dir_sd = kobj->sd; + const struct sysfs_ops *ops; + const void *ns = NULL; + int err; + + err = 0; + if (!sysfs_ns_type(dir_sd)) + goto out; + + err = -EINVAL; + if (!kobj->ktype) + goto out; + ops = kobj->ktype->sysfs_ops; + if (!ops) + goto out; + if (!ops->namespace) + goto out; + + err = 0; + ns = ops->namespace(kobj, attr); +out: + if (err) { + WARN(1, KERN_ERR "missing sysfs namespace attribute operation for " + "kobject: %s\n", kobject_name(kobj)); + } + *pns = ns; + return err; +} + int sysfs_add_file_mode(struct sysfs_dirent *dir_sd, const struct attribute *attr, int type, mode_t amode) { umode_t mode = (amode & S_IALLUGO) | S_IFREG; struct sysfs_addrm_cxt acxt; struct sysfs_dirent *sd; + const void *ns; int rc; + rc = sysfs_attr_ns(dir_sd->s_dir.kobj, attr, &ns); + if (rc) + return rc; + sd = sysfs_new_dirent(attr->name, mode, type); if (!sd) return -ENOMEM; + + sd->s_ns = ns; sd->s_attr.attr = (void *)attr; sysfs_dirent_init_lockdep(sd); @@ -586,12 +625,17 @@ int sysfs_chmod_file(struct kobject *kobj, const struct attribute *attr, { struct sysfs_dirent *sd; struct iattr newattrs; + const void *ns; int rc; + rc = sysfs_attr_ns(kobj, attr, &ns); + if (rc) + return rc; + mutex_lock(&sysfs_mutex); rc = -ENOENT; - sd = sysfs_find_dirent(kobj->sd, NULL, attr->name); + sd = sysfs_find_dirent(kobj->sd, ns, attr->name); if (!sd) goto out; @@ -616,7 +660,12 @@ EXPORT_SYMBOL_GPL(sysfs_chmod_file); void sysfs_remove_file(struct kobject * kobj, const struct attribute * attr) { - sysfs_hash_and_remove(kobj->sd, NULL, attr->name); + const void *ns; + + if (sysfs_attr_ns(kobj, attr, &ns)) + return; + + sysfs_hash_and_remove(kobj->sd, ns, attr->name); } void sysfs_remove_files(struct kobject * kobj, const struct attribute **ptr) diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index d7d2f21..dac0859 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h @@ -112,6 +112,7 @@ struct bin_attribute { struct sysfs_ops { ssize_t (*show)(struct kobject *, struct attribute *,char *); ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t); + const void *(*namespace)(struct kobject *, const struct attribute *); }; struct sysfs_dirent; -- 1.7.2.5 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/5] class: Implement support for class attrs in tagged sysfs directories. 2011-10-13 7:53 ` [PATCH 1/5] sysfs: Implement support for tagged files in sysfs Eric W. Biederman @ 2011-10-13 7:55 ` Eric W. Biederman 2011-10-13 7:56 ` [PATCH 3/5] bonding: Use a per netns implementation of /sys/class/net/bonding_masters Eric W. Biederman 0 siblings, 1 reply; 11+ messages in thread From: Eric W. Biederman @ 2011-10-13 7:55 UTC (permalink / raw) To: Greg Kroah-Hartman Cc: David Miller, linux-kernel, netdev, Tejun Heo, Jay Vosburgh, Andy Gospodarek Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- drivers/base/class.c | 17 +++++++++++++++-- include/linux/device.h | 2 ++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/base/class.c b/drivers/base/class.c index 4f1df2e..b80d91c 100644 --- a/drivers/base/class.c +++ b/drivers/base/class.c @@ -47,6 +47,18 @@ static ssize_t class_attr_store(struct kobject *kobj, struct attribute *attr, return ret; } +static const void *class_attr_namespace(struct kobject *kobj, + const struct attribute *attr) +{ + struct class_attribute *class_attr = to_class_attr(attr); + struct subsys_private *cp = to_subsys_private(kobj); + const void *ns = NULL; + + if (class_attr->namespace) + ns = class_attr->namespace(cp->class, class_attr); + return ns; +} + static void class_release(struct kobject *kobj) { struct subsys_private *cp = to_subsys_private(kobj); @@ -72,8 +84,9 @@ static const struct kobj_ns_type_operations *class_child_ns_type(struct kobject } static const struct sysfs_ops class_sysfs_ops = { - .show = class_attr_show, - .store = class_attr_store, + .show = class_attr_show, + .store = class_attr_store, + .namespace = class_attr_namespace, }; static struct kobj_type class_ktype = { diff --git a/include/linux/device.h b/include/linux/device.h index c20dfbf..ea70bb2 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -350,6 +350,8 @@ struct class_attribute { char *buf); ssize_t (*store)(struct class *class, struct class_attribute *attr, const char *buf, size_t count); + const void *(*namespace)(struct class *class, + const struct class_attribute *attr); }; #define CLASS_ATTR(_name, _mode, _show, _store) \ -- 1.7.2.5 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 3/5] bonding: Use a per netns implementation of /sys/class/net/bonding_masters. 2011-10-13 7:55 ` [PATCH 2/5] class: Implement support for class attrs in tagged sysfs directories Eric W. Biederman @ 2011-10-13 7:56 ` Eric W. Biederman 2011-10-13 8:01 ` [PATCH 4/5] sysfs: Remove support for tagged directories with untagged members Eric W. Biederman 0 siblings, 1 reply; 11+ messages in thread From: Eric W. Biederman @ 2011-10-13 7:56 UTC (permalink / raw) To: Greg Kroah-Hartman, David Miller Cc: linux-kernel, netdev, Tejun Heo, Jay Vosburgh, Andy Gospodarek This fixes a network namespace misfeature that bonding_masters looked at current instead of the remembering the context where in which /sys/class/net/bonding_masters was opened in to see which network namespace to act upon. This removes the need for sysfs to handle tagged directories with untagged members allowing for a conceptually simpler sysfs implementation. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- drivers/net/bonding/bond_main.c | 7 +---- drivers/net/bonding/bond_sysfs.c | 45 ++++++++++++++++++++++++++----------- drivers/net/bonding/bonding.h | 7 ++++- 3 files changed, 38 insertions(+), 21 deletions(-) diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 6d79b78..e084b1c 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -4898,6 +4898,7 @@ static int __net_init bond_net_init(struct net *net) INIT_LIST_HEAD(&bn->dev_list); bond_create_proc_dir(bn); + bond_create_sysfs(bn); return 0; } @@ -4906,6 +4907,7 @@ static void __net_exit bond_net_exit(struct net *net) { struct bond_net *bn = net_generic(net, bond_net_id); + bond_destroy_sysfs(bn); bond_destroy_proc_dir(bn); } @@ -4943,10 +4945,6 @@ static int __init bonding_init(void) goto err; } - res = bond_create_sysfs(); - if (res) - goto err; - register_netdevice_notifier(&bond_netdev_notifier); register_inetaddr_notifier(&bond_inetaddr_notifier); out: @@ -4964,7 +4962,6 @@ static void __exit bonding_exit(void) unregister_netdevice_notifier(&bond_netdev_notifier); unregister_inetaddr_notifier(&bond_inetaddr_notifier); - bond_destroy_sysfs(); bond_destroy_debugfs(); rtnl_link_unregister(&bond_link_ops); diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index 2dfb4bf..6044ff8 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c @@ -55,8 +55,8 @@ static ssize_t bonding_show_bonds(struct class *cls, struct class_attribute *attr, char *buf) { - struct net *net = current->nsproxy->net_ns; - struct bond_net *bn = net_generic(net, bond_net_id); + struct bond_net *bn = + container_of(attr, struct bond_net, class_attr_bonding_masters); int res = 0; struct bonding *bond; @@ -79,9 +79,8 @@ static ssize_t bonding_show_bonds(struct class *cls, return res; } -static struct net_device *bond_get_by_name(struct net *net, const char *ifname) +static struct net_device *bond_get_by_name(struct bond_net *bn, const char *ifname) { - struct bond_net *bn = net_generic(net, bond_net_id); struct bonding *bond; list_for_each_entry(bond, &bn->dev_list, bond_list) { @@ -103,7 +102,8 @@ static ssize_t bonding_store_bonds(struct class *cls, struct class_attribute *attr, const char *buffer, size_t count) { - struct net *net = current->nsproxy->net_ns; + struct bond_net *bn = + container_of(attr, struct bond_net, class_attr_bonding_masters); char command[IFNAMSIZ + 1] = {0, }; char *ifname; int rv, res = count; @@ -116,7 +116,7 @@ static ssize_t bonding_store_bonds(struct class *cls, if (command[0] == '+') { pr_info("%s is being created...\n", ifname); - rv = bond_create(net, ifname); + rv = bond_create(bn->net, ifname); if (rv) { if (rv == -EEXIST) pr_info("%s already exists.\n", ifname); @@ -128,7 +128,7 @@ static ssize_t bonding_store_bonds(struct class *cls, struct net_device *bond_dev; rtnl_lock(); - bond_dev = bond_get_by_name(net, ifname); + bond_dev = bond_get_by_name(bn, ifname); if (bond_dev) { pr_info("%s is being deleted...\n", ifname); unregister_netdevice(bond_dev); @@ -150,9 +150,24 @@ err_no_cmd: return -EPERM; } +static const void *bonding_namespace(struct class *cls, + const struct class_attribute *attr) +{ + const struct bond_net *bn = + container_of(attr, struct bond_net, class_attr_bonding_masters); + return bn->net; +} + /* class attribute for bond_masters file. This ends up in /sys/class/net */ -static CLASS_ATTR(bonding_masters, S_IWUSR | S_IRUGO, - bonding_show_bonds, bonding_store_bonds); +static const struct class_attribute class_attr_bonding_masters = { + .attr = { + .name = "bonding_masters", + .mode = S_IWUSR | S_IRUGO, + }, + .show = bonding_show_bonds, + .store = bonding_store_bonds, + .namespace = bonding_namespace, +}; int bond_create_slave_symlinks(struct net_device *master, struct net_device *slave) @@ -1655,11 +1670,13 @@ static struct attribute_group bonding_group = { * Initialize sysfs. This sets up the bonding_masters file in * /sys/class/net. */ -int bond_create_sysfs(void) +int bond_create_sysfs(struct bond_net *bn) { int ret; - ret = netdev_class_create_file(&class_attr_bonding_masters); + bn->class_attr_bonding_masters = class_attr_bonding_masters; + + ret = netdev_class_create_file(&bn->class_attr_bonding_masters); /* * Permit multiple loads of the module by ignoring failures to * create the bonding_masters sysfs file. Bonding devices @@ -1673,7 +1690,7 @@ int bond_create_sysfs(void) */ if (ret == -EEXIST) { /* Is someone being kinky and naming a device bonding_master? */ - if (__dev_get_by_name(&init_net, + if (__dev_get_by_name(bn->net, class_attr_bonding_masters.attr.name)) pr_err("network device named %s already exists in sysfs", class_attr_bonding_masters.attr.name); @@ -1687,9 +1704,9 @@ int bond_create_sysfs(void) /* * Remove /sys/class/net/bonding_masters. */ -void bond_destroy_sysfs(void) +void bond_destroy_sysfs(struct bond_net *bn) { - netdev_class_remove_file(&class_attr_bonding_masters); + netdev_class_remove_file(&bn->class_attr_bonding_masters); } /* diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h index 43526a2..1007f9a 100644 --- a/drivers/net/bonding/bonding.h +++ b/drivers/net/bonding/bonding.h @@ -380,11 +380,13 @@ static inline bool bond_is_slave_inactive(struct slave *slave) return slave->inactive; } +struct bond_net; + struct vlan_entry *bond_next_vlan(struct bonding *bond, struct vlan_entry *curr); int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, struct net_device *slave_dev); int bond_create(struct net *net, const char *name); -int bond_create_sysfs(void); -void bond_destroy_sysfs(void); +int bond_create_sysfs(struct bond_net *net); +void bond_destroy_sysfs(struct bond_net *net); void bond_prepare_sysfs_group(struct bonding *bond); int bond_create_slave_symlinks(struct net_device *master, struct net_device *slave); void bond_destroy_slave_symlinks(struct net_device *master, struct net_device *slave); @@ -410,6 +412,7 @@ struct bond_net { #ifdef CONFIG_PROC_FS struct proc_dir_entry * proc_dir; #endif + struct class_attribute class_attr_bonding_masters; }; #ifdef CONFIG_PROC_FS -- 1.7.2.5 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 4/5] sysfs: Remove support for tagged directories with untagged members. 2011-10-13 7:56 ` [PATCH 3/5] bonding: Use a per netns implementation of /sys/class/net/bonding_masters Eric W. Biederman @ 2011-10-13 8:01 ` Eric W. Biederman 2011-10-13 8:02 ` [PATCH 5/5] sysfs: Reject with a warning invalid uses of tagged directories Eric W. Biederman 0 siblings, 1 reply; 11+ messages in thread From: Eric W. Biederman @ 2011-10-13 8:01 UTC (permalink / raw) To: Greg Kroah-Hartman, David Miller Cc: linux-kernel, netdev, Tejun Heo, Jay Vosburgh, Andy Gospodarek Now that /sys/class/net/bonding_masters is implemented as a tagged sysfs file we can remove support for untagged files in tagged directories. This change removes any ambiguity of what a NULL namespace value means. A NULL namespace parameter after this patch means that we are talking about an untagged sysfs dirent. This makes the sysfs code much less prone to mistakes when during maintenance. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- fs/sysfs/dir.c | 6 +++--- fs/sysfs/inode.c | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index ea9120a..352d26d 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c @@ -543,7 +543,7 @@ struct sysfs_dirent *sysfs_find_dirent(struct sysfs_dirent *parent_sd, struct sysfs_dirent *sd; for (sd = parent_sd->s_dir.children; sd; sd = sd->s_sibling) { - if (ns && sd->s_ns && (sd->s_ns != ns)) + if (sd->s_ns != ns) continue; if (!strcmp(sd->s_name, name)) return sd; @@ -885,7 +885,7 @@ static struct sysfs_dirent *sysfs_dir_pos(const void *ns, while (pos && (ino > pos->s_ino)) pos = pos->s_sibling; } - while (pos && pos->s_ns && pos->s_ns != ns) + while (pos && pos->s_ns != ns) pos = pos->s_sibling; return pos; } @@ -896,7 +896,7 @@ static struct sysfs_dirent *sysfs_dir_next_pos(const void *ns, pos = sysfs_dir_pos(ns, parent_sd, ino, pos); if (pos) pos = pos->s_sibling; - while (pos && pos->s_ns && pos->s_ns != ns) + while (pos && pos->s_ns != ns) pos = pos->s_sibling; return pos; } diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c index e3f091a..527f0cc 100644 --- a/fs/sysfs/inode.c +++ b/fs/sysfs/inode.c @@ -336,8 +336,6 @@ int sysfs_hash_and_remove(struct sysfs_dirent *dir_sd, const void *ns, const cha sysfs_addrm_start(&acxt, dir_sd); sd = sysfs_find_dirent(dir_sd, ns, name); - if (sd && (sd->s_ns != ns)) - sd = NULL; if (sd) sysfs_remove_one(&acxt, sd); -- 1.7.2.5 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 5/5] sysfs: Reject with a warning invalid uses of tagged directories. 2011-10-13 8:01 ` [PATCH 4/5] sysfs: Remove support for tagged directories with untagged members Eric W. Biederman @ 2011-10-13 8:02 ` Eric W. Biederman 0 siblings, 0 replies; 11+ messages in thread From: Eric W. Biederman @ 2011-10-13 8:02 UTC (permalink / raw) To: Greg Kroah-Hartman, David Miller Cc: linux-kernel, netdev, Tejun Heo, Jay Vosburgh, Andy Gospodarek sysfs is a core piece of ifrastructure that many people use and few people have all of the rules in their head on how to use it correctly. Add warnings for people using tagged directories improperly to that any misuses can be caught and diagnosed quickly. A single inexpensive test in sysfs_find_dirent is almost sufficient to catch all possible misuses. An additional warning is needed in sysfs_add_dirent so that we actually fail when attempting to add an untagged dirent in a tagged directory. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> --- fs/sysfs/dir.c | 14 ++++++++++++++ fs/sysfs/file.c | 3 --- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index 352d26d..26f370a 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c @@ -384,6 +384,13 @@ int __sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd) { struct sysfs_inode_attrs *ps_iattr; + if (!!sysfs_ns_type(acxt->parent_sd) != !!sd->s_ns) { + WARN(1, KERN_WARNING "sysfs: ns %s in '%s' for '%s'\n", + sysfs_ns_type(acxt->parent_sd)? "required": "invalid", + acxt->parent_sd->s_name, sd->s_name); + return -EINVAL; + } + if (sysfs_find_dirent(acxt->parent_sd, sd->s_ns, sd->s_name)) return -EEXIST; @@ -542,6 +549,13 @@ struct sysfs_dirent *sysfs_find_dirent(struct sysfs_dirent *parent_sd, { struct sysfs_dirent *sd; + if (!!sysfs_ns_type(parent_sd) != !!ns) { + WARN(1, KERN_WARNING "sysfs: ns %s in '%s' for '%s'\n", + sysfs_ns_type(parent_sd)? "required": "invalid", + parent_sd->s_name, name); + return NULL; + } + for (sd = parent_sd->s_dir.children; sd; sd = sd->s_sibling) { if (sd->s_ns != ns) continue; diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index 07c1b4e..d4e6080 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c @@ -466,9 +466,6 @@ void sysfs_notify(struct kobject *k, const char *dir, const char *attr) mutex_lock(&sysfs_mutex); if (sd && dir) - /* Only directories are tagged, so no need to pass - * a tag explicitly. - */ sd = sysfs_find_dirent(sd, NULL, dir); if (sd && attr) sd = sysfs_find_dirent(sd, NULL, attr); -- 1.7.2.5 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 0/5] Better namespace handling for /sys/class/net/bonding_masters 2011-10-13 7:47 [PATCH 0/5] Better namespace handling for /sys/class/net/bonding_masters Eric W. Biederman 2011-10-13 7:53 ` [PATCH 1/5] sysfs: Implement support for tagged files in sysfs Eric W. Biederman @ 2011-10-13 17:25 ` Greg KH 2011-10-19 4:09 ` David Miller 2 siblings, 0 replies; 11+ messages in thread From: Greg KH @ 2011-10-13 17:25 UTC (permalink / raw) To: Eric W. Biederman Cc: David Miller, linux-kernel, netdev, Tejun Heo, Jay Vosburgh, Andy Gospodarek On Thu, Oct 13, 2011 at 12:47:46AM -0700, Eric W. Biederman wrote: > > When I was looking at another sysfs issue that Al pointed out (since > fixed) I realized that I had implemented a trivial code size but overly > clever way to handle /sys/class/net/bonding_masters. > > This patchset removes the support for untagged entries in tagged > directories (that is currently used to support bonding_masters) > and replaces it with support for tagged sysfs attributes. > > In the process this fixes a small misfeature in how bonding_masters > derives the network namespace we are dealing with. This change > allows bonding_masters to derive the network namespace from the > copy of bonding_masters we open instead of magically from current. > > The final patch of this patchset adds sanity checks to sysfs. To > ensure that we don't accidentally mishandle tagged sysfs entities. > > I have tested this code against 3.1-rc9 on my laptop with a mostly yes > config and I am not seeing any problems. The loud screaming warnings I > have added in the last patch should catch any corner cases in how people > use sysfs that I might have overlooked. > > Greg, Dave I'm don't know whose tree to merge this through as this code > is equally device-core and networking. I am hoping that we can get this > improvement merged for 3.2. These all look fine to me, and I have no problem with them going through the network tree as that will most likely be the easiest way due to any potential merge issues. David, feel free to add an: Acked-by: Greg Kroah-Hartman <gregkh@suse.de> to these patches and take them through your tree if that is ok with you. If not, I can also always take them through mine, it's your choice. thanks, greg k-h ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 0/5] Better namespace handling for /sys/class/net/bonding_masters 2011-10-13 7:47 [PATCH 0/5] Better namespace handling for /sys/class/net/bonding_masters Eric W. Biederman 2011-10-13 7:53 ` [PATCH 1/5] sysfs: Implement support for tagged files in sysfs Eric W. Biederman 2011-10-13 17:25 ` [PATCH 0/5] Better namespace handling for /sys/class/net/bonding_masters Greg KH @ 2011-10-19 4:09 ` David Miller 2011-10-19 13:27 ` Eric W. Biederman 2011-10-19 14:36 ` Greg KH 2 siblings, 2 replies; 11+ messages in thread From: David Miller @ 2011-10-19 4:09 UTC (permalink / raw) To: ebiederm; +Cc: gregkh, linux-kernel, netdev, htejun, fubar, andy From: ebiederm@xmission.com (Eric W. Biederman) Date: Thu, 13 Oct 2011 00:47:46 -0700 > Greg, Dave I'm don't know whose tree to merge this through as this code > is equally device-core and networking. I am hoping that we can get this > improvement merged for 3.2. I'm happy to take this series into my net-next tree. Greg? Any objections? ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 0/5] Better namespace handling for /sys/class/net/bonding_masters 2011-10-19 4:09 ` David Miller @ 2011-10-19 13:27 ` Eric W. Biederman 2011-10-19 22:49 ` David Miller 2011-10-19 14:36 ` Greg KH 1 sibling, 1 reply; 11+ messages in thread From: Eric W. Biederman @ 2011-10-19 13:27 UTC (permalink / raw) To: David Miller; +Cc: gregkh, linux-kernel, netdev, htejun, fubar, andy David Miller <davem@davemloft.net> writes: > From: ebiederm@xmission.com (Eric W. Biederman) > Date: Thu, 13 Oct 2011 00:47:46 -0700 > >> Greg, Dave I'm don't know whose tree to merge this through as this code >> is equally device-core and networking. I am hoping that we can get this >> improvement merged for 3.2. > > I'm happy to take this series into my net-next tree. > > Greg? Any objections? on the 13th Greg said: > These all look fine to me, and I have no problem with them going through > the network tree as that will most likely be the easiest way due to any > potential merge issues. > > David, feel free to add an: > Acked-by: Greg Kroah-Hartman <gregkh@suse.de> > > to these patches and take them through your tree if that is ok with you. > If not, I can also always take them through mine, it's your choice. Eric ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 0/5] Better namespace handling for /sys/class/net/bonding_masters 2011-10-19 13:27 ` Eric W. Biederman @ 2011-10-19 22:49 ` David Miller 0 siblings, 0 replies; 11+ messages in thread From: David Miller @ 2011-10-19 22:49 UTC (permalink / raw) To: ebiederm; +Cc: gregkh, linux-kernel, netdev, htejun, fubar, andy From: ebiederm@xmission.com (Eric W. Biederman) Date: Wed, 19 Oct 2011 06:27:25 -0700 > David Miller <davem@davemloft.net> writes: > >> From: ebiederm@xmission.com (Eric W. Biederman) >> Date: Thu, 13 Oct 2011 00:47:46 -0700 >> >>> Greg, Dave I'm don't know whose tree to merge this through as this code >>> is equally device-core and networking. I am hoping that we can get this >>> improvement merged for 3.2. >> >> I'm happy to take this series into my net-next tree. >> >> Greg? Any objections? > > on the 13th Greg said: > >> These all look fine to me, and I have no problem with them going through >> the network tree as that will most likely be the easiest way due to any >> potential merge issues. >> >> David, feel free to add an: >> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Awesome, thanks for the reminder, I'll apply these right now. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 0/5] Better namespace handling for /sys/class/net/bonding_masters 2011-10-19 4:09 ` David Miller 2011-10-19 13:27 ` Eric W. Biederman @ 2011-10-19 14:36 ` Greg KH 1 sibling, 0 replies; 11+ messages in thread From: Greg KH @ 2011-10-19 14:36 UTC (permalink / raw) To: David Miller; +Cc: ebiederm, linux-kernel, netdev, htejun, fubar, andy On Wed, Oct 19, 2011 at 12:09:32AM -0400, David Miller wrote: > From: ebiederm@xmission.com (Eric W. Biederman) > Date: Thu, 13 Oct 2011 00:47:46 -0700 > > > Greg, Dave I'm don't know whose tree to merge this through as this code > > is equally device-core and networking. I am hoping that we can get this > > improvement merged for 3.2. > > I'm happy to take this series into my net-next tree. > > Greg? Any objections? Nope: Acked-by: Greg Kroah-Hartman <gregkh@suse.de> ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2011-10-19 22:49 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-10-13 7:47 [PATCH 0/5] Better namespace handling for /sys/class/net/bonding_masters Eric W. Biederman 2011-10-13 7:53 ` [PATCH 1/5] sysfs: Implement support for tagged files in sysfs Eric W. Biederman 2011-10-13 7:55 ` [PATCH 2/5] class: Implement support for class attrs in tagged sysfs directories Eric W. Biederman 2011-10-13 7:56 ` [PATCH 3/5] bonding: Use a per netns implementation of /sys/class/net/bonding_masters Eric W. Biederman 2011-10-13 8:01 ` [PATCH 4/5] sysfs: Remove support for tagged directories with untagged members Eric W. Biederman 2011-10-13 8:02 ` [PATCH 5/5] sysfs: Reject with a warning invalid uses of tagged directories Eric W. Biederman 2011-10-13 17:25 ` [PATCH 0/5] Better namespace handling for /sys/class/net/bonding_masters Greg KH 2011-10-19 4:09 ` David Miller 2011-10-19 13:27 ` Eric W. Biederman 2011-10-19 22:49 ` David Miller 2011-10-19 14:36 ` Greg KH
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).