aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph
diff options
context:
space:
mode:
authorCyril Roelandt <tipecaml@gmail.com>2012-11-20 10:23:07 -0600
committerAlex Elder <elder@inktank.com>2012-12-13 08:13:06 -0600
commitcfc84c9f73ab8a6933bd4f36efac1196cddad581 (patch)
tree94992a63a3abcf3a04eb2340d895470fb402d663 /fs/ceph
parent22cddde104d715600a4c218bf9224923208afe90 (diff)
ceph: fix dentry reference leak in ceph_encode_fh().
dput() was not called in the error path. Signed-off-by: Cyril Roelandt <tipecaml@gmail.com> Reviewed-by: Alex Elder <elder@inktank.com>
Diffstat (limited to 'fs/ceph')
-rw-r--r--fs/ceph/export.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/ceph/export.c b/fs/ceph/export.c
index 862887004d2..f350be34601 100644
--- a/fs/ceph/export.c
+++ b/fs/ceph/export.c
@@ -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);