ceph: fix dentry reference leak in ceph_encode_fh().
authorCyril Roelandt <tipecaml@gmail.com>
Tue, 20 Nov 2012 16:23:07 +0000 (10:23 -0600)
committerAlex Elder <elder@inktank.com>
Thu, 13 Dec 2012 14:13:06 +0000 (08:13 -0600)
dput() was not called in the error path.

Signed-off-by: Cyril Roelandt <tipecaml@gmail.com>
Reviewed-by: Alex Elder <elder@inktank.com>
fs/ceph/export.c

index 862887004d2060bb0fce8e4cac8a0b65d1f5c728..f350be34601f01723520f8aa6bc2b483f70df21b 100644 (file)
@@ -56,13 +56,15 @@ static int ceph_encode_fh(struct inode *inode, u32 *rawfh, int *max_len,
        struct ceph_nfs_confh *cfh = (void *)rawfh;
        int connected_handle_length = sizeof(*cfh)/4;
        int handle_length = sizeof(*fh)/4;
-       struct dentry *dentry = d_find_alias(inode);
+       struct dentry *dentry;
        struct dentry *parent;
 
        /* don't re-export snaps */
        if (ceph_snap(inode) != CEPH_NOSNAP)
                return -EINVAL;
 
+       dentry = d_find_alias(inode);
+
        /* if we found an alias, generate a connectable fh */
        if (*max_len >= connected_handle_length && dentry) {
                dout("encode_fh %p connectable\n", dentry);