]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
create_mnt_ns: unidiomatic use of list_add()
authorAl Viro <viro@zeniv.linux.org.uk>
Sat, 4 May 2013 19:18:53 +0000 (15:18 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Sat, 4 May 2013 19:18:53 +0000 (15:18 -0400)
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>
fs/namespace.c

index b68eef2d592ab2c51fc89389b179963fcd95e4a8..7b1ca9ba0b0a70213915f6d7bce688184ab7a56f 100644 (file)
@@ -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);
        }