diff options
author | Eric W. Biederman <ebiederm@maxwell.aristanetworks.com> | 2010-03-30 14:31:27 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-05-21 12:37:31 -0400 |
commit | af10ec77b43335ab4e473e4087d85979caf02d65 (patch) | |
tree | 2a3c78d5c17e0305f30f02cb9b716f1634ad7c87 /fs/sysfs/dir.c | |
parent | 3ff195b011d7decf501a4d55aeed312731094796 (diff) |
sysfs: Add support for tagged directories with untagged members.
I had hopped to avoid this but the bonding driver adds a file
to /sys/class/net/ and the easiest way to handle that file is
to make it untagged and to register it only once.
So relax the rules on tagged directories, and make bonding work.
Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs/sysfs/dir.c')
-rw-r--r-- | fs/sysfs/dir.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index b2b83067ccc8..a63eb4ba7867 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c | |||
@@ -383,12 +383,6 @@ int __sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd) | |||
383 | if (sysfs_find_dirent(acxt->parent_sd, sd->s_ns, sd->s_name)) | 383 | if (sysfs_find_dirent(acxt->parent_sd, sd->s_ns, sd->s_name)) |
384 | return -EEXIST; | 384 | return -EEXIST; |
385 | 385 | ||
386 | if (sysfs_ns_type(acxt->parent_sd) && !sd->s_ns) { | ||
387 | WARN(1, KERN_WARNING "sysfs: ns required in '%s' for '%s'\n", | ||
388 | acxt->parent_sd->s_name, sd->s_name); | ||
389 | return -EINVAL; | ||
390 | } | ||
391 | |||
392 | sd->s_parent = sysfs_get(acxt->parent_sd); | 386 | sd->s_parent = sysfs_get(acxt->parent_sd); |
393 | 387 | ||
394 | sysfs_link_sibling(sd); | 388 | sysfs_link_sibling(sd); |
@@ -545,7 +539,7 @@ struct sysfs_dirent *sysfs_find_dirent(struct sysfs_dirent *parent_sd, | |||
545 | struct sysfs_dirent *sd; | 539 | struct sysfs_dirent *sd; |
546 | 540 | ||
547 | for (sd = parent_sd->s_dir.children; sd; sd = sd->s_sibling) { | 541 | for (sd = parent_sd->s_dir.children; sd; sd = sd->s_sibling) { |
548 | if (sd->s_ns != ns) | 542 | if (ns && sd->s_ns && (sd->s_ns != ns)) |
549 | continue; | 543 | continue; |
550 | if (!strcmp(sd->s_name, name)) | 544 | if (!strcmp(sd->s_name, name)) |
551 | return sd; | 545 | return sd; |
@@ -879,7 +873,7 @@ static struct sysfs_dirent *sysfs_dir_pos(const void *ns, | |||
879 | while (pos && (ino > pos->s_ino)) | 873 | while (pos && (ino > pos->s_ino)) |
880 | pos = pos->s_sibling; | 874 | pos = pos->s_sibling; |
881 | } | 875 | } |
882 | while (pos && pos->s_ns != ns) | 876 | while (pos && pos->s_ns && pos->s_ns != ns) |
883 | pos = pos->s_sibling; | 877 | pos = pos->s_sibling; |
884 | return pos; | 878 | return pos; |
885 | } | 879 | } |
@@ -890,7 +884,7 @@ static struct sysfs_dirent *sysfs_dir_next_pos(const void *ns, | |||
890 | pos = sysfs_dir_pos(ns, parent_sd, ino, pos); | 884 | pos = sysfs_dir_pos(ns, parent_sd, ino, pos); |
891 | if (pos) | 885 | if (pos) |
892 | pos = pos->s_sibling; | 886 | pos = pos->s_sibling; |
893 | while (pos && pos->s_ns != ns) | 887 | while (pos && pos->s_ns && pos->s_ns != ns) |
894 | pos = pos->s_sibling; | 888 | pos = pos->s_sibling; |
895 | return pos; | 889 | return pos; |
896 | } | 890 | } |