namei: make put_link() RCU-safe
authorAl Viro <viro@zeniv.linux.org.uk>
Fri, 8 May 2015 00:32:22 +0000 (20:32 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Mon, 11 May 2015 12:13:13 +0000 (08:13 -0400)
very simple - just make path_put() conditional on !RCU.
Note that right now it doesn't get called in RCU mode -
we leave it before getting anything into stack.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/namei.c

index 43034046a0e1221854eddc8eaf726347f77d5290..998c3c2c94886be16972c98a16c0afbf857ca6ea 100644 (file)
@@ -750,7 +750,8 @@ static inline void put_link(struct nameidata *nd)
        struct inode *inode = last->inode;
        if (last->cookie && inode->i_op->put_link)
                inode->i_op->put_link(inode, last->cookie);
-       path_put(&last->link);
+       if (!(nd->flags & LOOKUP_RCU))
+               path_put(&last->link);
 }
 
 int sysctl_protected_symlinks __read_mostly = 0;