summaryrefslogtreecommitdiffstats
path: root/fs/ceph
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2012-01-03 17:20:40 +0100
committerSage Weil <sage@newdream.net>2012-01-10 17:57:00 +0100
commitee6b1baf67591b6d7ce1a6a07544343433d5ec9e (patch)
tree8aac5a6a2172d84d4188fe97bf3fe84aa558dc75 /fs/ceph
parentceph: dereference pointer after checking for NULL (diff)
downloadlinux-ee6b1baf67591b6d7ce1a6a07544343433d5ec9e.tar.xz
linux-ee6b1baf67591b6d7ce1a6a07544343433d5ec9e.zip
ceph: avoid useless dget/dput in encode_fh
Nothing we do here sleeps, so just do it under d_lock and avoid the dget/ dput entirely. Reported-by: Al Viro <viro@ZenIV.linux.org.uk> Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph')
-rw-r--r--fs/ceph/export.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/ceph/export.c b/fs/ceph/export.c
index 9fbcdecaaccd..fbb2a643ef10 100644
--- a/fs/ceph/export.c
+++ b/fs/ceph/export.c
@@ -56,9 +56,7 @@ static int ceph_encode_fh(struct dentry *dentry, u32 *rawfh, int *max_len,
return -EINVAL;
spin_lock(&dentry->d_lock);
- parent = dget(dentry->d_parent);
- spin_unlock(&dentry->d_lock);
-
+ parent = dentry->d_parent;
if (*max_len >= connected_handle_length) {
dout("encode_fh %p connectable\n", dentry);
cfh->ino = ceph_ino(dentry->d_inode);
@@ -81,7 +79,7 @@ static int ceph_encode_fh(struct dentry *dentry, u32 *rawfh, int *max_len,
*max_len = handle_length;
type = 255;
}
- dput(parent);
+ spin_unlock(&dentry->d_lock);
return type;
}