From: Valerie Aurora <vaurora@xxxxxxxxxx> do_lookup_union() locks the parent directory and follows the mount after lookup. It is appropriate for calling from do_lookup(). Signed-off-by: Valerie Aurora <valerie.aurora@xxxxxxxxx> --- fs/namei.c | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index 8257537..3fcb42c 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -909,6 +909,28 @@ static int lookup_union(struct nameidata *nd, struct qstr *name, } /* + * do_union_lookup - union mount-aware part of do_lookup + * + * do_lookup()-style wrapper for lookup_union(). Follows mounts. + */ + +static int do_lookup_union(struct nameidata *nd, struct qstr *name, + struct path *topmost) +{ + struct dentry *parent = nd->path.dentry; + struct inode *dir = parent->d_inode; + int err; + + mutex_lock(&dir->i_mutex); + err = lookup_union(nd, name, topmost); + mutex_unlock(&dir->i_mutex); + + __follow_mount(topmost); + + return err; +} + +/* * Allocate a dentry with name and parent, and perform a parent * directory ->lookup on it. Returns the new dentry, or ERR_PTR * on error. parent->d_inode->i_mutex must be held. d_lookup must -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html