Whamcloud - gitweb
LU-1994 llite: don't release nd->path in ll_follow_link
authoryangsheng <ys@whamcloud.com>
Wed, 19 Dec 2012 08:07:19 +0000 (16:07 +0800)
committerOleg Drokin <green@whamcloud.com>
Fri, 21 Dec 2012 17:37:30 +0000 (12:37 -0500)
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 <tao.peng@emc.com>
Signed-off-by: yang sheng <yang.sheng@intel.com>
Change-Id: I13b7e00822b983c47183ee38357e4490bea3c52c
Reviewed-on: http://review.whamcloud.com/4487
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Lai Siyao <laisiyao@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/llite/symlink.c

index 67a3107..15f87fe 100644 (file)
@@ -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);
         }
                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);
 
        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)
 }
 
 static void ll_put_link(struct dentry *dentry, struct nameidata *nd, void *cookie)