Skip to content

Commit

Permalink
sysfs: Update the name hash for an entry after changing the namespace
Browse files Browse the repository at this point in the history
This is needed to allow renaming network devices that have been moved
to another network namespace.

Signed-off-by: Tom Goff <thomas.goff@boeing.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Tom Goff authored and Greg Kroah-Hartman committed Apr 9, 2012
1 parent 3a4ffe9 commit 70fa4a6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/sysfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -878,14 +878,14 @@ int sysfs_rename(struct sysfs_dirent *sd,

dup_name = sd->s_name;
sd->s_name = new_name;
sd->s_hash = sysfs_name_hash(sd->s_ns, sd->s_name);
}

/* Move to the appropriate place in the appropriate directories rbtree. */
sysfs_unlink_sibling(sd);
sysfs_get(new_parent_sd);
sysfs_put(sd->s_parent);
sd->s_ns = new_ns;
sd->s_hash = sysfs_name_hash(sd->s_ns, sd->s_name);
sd->s_parent = new_parent_sd;
sysfs_link_sibling(sd);

Expand Down

0 comments on commit 70fa4a6

Please sign in to comment.