Skip to content

Commit

Permalink
create_mnt_ns: unidiomatic use of list_add()
Browse files Browse the repository at this point in the history
while list_add(A, B) and list_add(B, A) are equivalent when both A and B
are guaranteed to be empty, the usual idiom is list_add(what, where),
not the other way round...  Not a bug per se, but only by accident and
it makes RTFS harder for no good reason.

Spotted-by: Rajat Sharma <fs.rajat@gmail.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed May 4, 2013
1 parent 61572bb commit b1983cd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -2463,7 +2463,7 @@ static struct mnt_namespace *create_mnt_ns(struct vfsmount *m)
struct mount *mnt = real_mount(m);
mnt->mnt_ns = new_ns;
new_ns->root = mnt;
list_add(&new_ns->list, &mnt->mnt_list);
list_add(&mnt->mnt_list, &new_ns->list);
} else {
mntput(m);
}
Expand Down

0 comments on commit b1983cd

Please sign in to comment.