From: Erez Zadok Date: Thu, 28 Apr 2011 06:12:55 +0000 (-0400) Subject: VFS: introduce lookup_one_len_nd X-Git-Tag: unionfs-2.5.9.2~9 X-Git-Url: https://git.fsl.cs.sunysb.edu/?a=commitdiff_plain;h=abae343d279df2f502c84104a2b264d39f733a76;p=unionfs-2.6.38.y.git VFS: introduce lookup_one_len_nd Just like lookup_one_len() but passes a nameidata parameter, which is now required by NFS3, else you get an oops. Signed-off-by: Erez Zadok --- diff --git a/fs/namei.c b/fs/namei.c index 6f7c1da04a8..db2a6743fdf 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -1896,6 +1896,22 @@ struct dentry *lookup_one_len(const char *name, struct dentry *base, int len) return __lookup_hash(&this, base, NULL); } +/* pass nameidata from caller (useful for NFS) */ +struct dentry *lookup_one_len_nd(const char *name, struct dentry *base, + int len, struct nameidata *nd) +{ + int err; + struct qstr this; + + WARN_ON_ONCE(!mutex_is_locked(&base->d_inode->i_mutex)); + + err = __lookup_one_len(name, &this, base, len); + if (err) + return ERR_PTR(err); + + return __lookup_hash(&this, base, nd); +} + int user_path_at(int dfd, const char __user *name, unsigned flags, struct path *path) { @@ -3582,6 +3598,7 @@ EXPORT_SYMBOL(get_write_access); /* binfmt_aout */ EXPORT_SYMBOL(getname); EXPORT_SYMBOL(lock_rename); EXPORT_SYMBOL(lookup_one_len); +EXPORT_SYMBOL(lookup_one_len_nd); EXPORT_SYMBOL(page_follow_link_light); EXPORT_SYMBOL(page_put_link); EXPORT_SYMBOL(page_readlink); diff --git a/include/linux/namei.h b/include/linux/namei.h index cf4ec6c12a3..c90e03b8ab2 100644 --- a/include/linux/namei.h +++ b/include/linux/namei.h @@ -81,6 +81,8 @@ extern struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry extern void release_open_intent(struct nameidata *); extern struct dentry *lookup_one_len(const char *, struct dentry *, int); +extern struct dentry *lookup_one_len_nd(const char *, struct dentry *, int, + struct nameidata *nd); extern int follow_down_one(struct path *); extern int follow_down(struct path *, bool);