From: yangsheng Date: Wed, 19 Dec 2012 08:07:19 +0000 (+0800) Subject: LU-1994 llite: don't release nd->path in ll_follow_link X-Git-Tag: 2.3.58~11 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=776a65514bf407d46e1f5442e6799788a6365ba8 LU-1994 llite: don't release nd->path in ll_follow_link For 3.6 kernel, .follow_link is not allowed to release nd, as VFS handles itself on error path. So we change to not do it and report error via nd_set_link(). For all kernels, if ll_follow_link returns NULL and set error via nd_set_link, VFS will release nd->path in __vfs_follow_link(). This also matches most in-kernel fs behavior. Signed-off-by: Peng Tao Signed-off-by: yang sheng Change-Id: I13b7e00822b983c47183ee38357e4490bea3c52c Reviewed-on: http://review.whamcloud.com/4487 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Lai Siyao Reviewed-by: Oleg Drokin --- diff --git a/lustre/llite/symlink.c b/lustre/llite/symlink.c index 67a3107..15f87fe 100644 --- a/lustre/llite/symlink.c +++ b/lustre/llite/symlink.c @@ -160,20 +160,17 @@ static void *ll_follow_link(struct dentry *dentry, struct nameidata *nd) rc = ll_readlink_internal(inode, &request, &symname); ll_inode_size_unlock(inode); } - if (rc) { - cfs_path_put(nd); /* Kernel assumes that ->follow_link() - releases nameidata on error */ - GOTO(out, rc); - } + if (rc) { + ptlrpc_req_finished(request); + request = NULL; + symname = ERR_PTR(rc); + } nd_set_link(nd, symname); /* symname may contain a pointer to the request message buffer, * we delay request releasing until ll_put_link then. */ RETURN(request); -out: - ptlrpc_req_finished(request); - RETURN(ERR_PTR(rc)); } static void ll_put_link(struct dentry *dentry, struct nameidata *nd, void *cookie)