ceph: avoid inode lookup on nfs fh reconnect
authorSage Weil <sage@newdream.net>
Wed, 6 Apr 2011 16:35:00 +0000 (09:35 -0700)
committerSage Weil <sage@newdream.net>
Tue, 24 May 2011 18:52:06 +0000 (11:52 -0700)
If we get the inode from the MDS, we have a reference in req; don't do a
fresh lookup.

Signed-off-by: Sage Weil <sage@newdream.net>
fs/ceph/export.c

index f1828af09912b610005752f3f44cb2ae32276d90..a610d3d674886a082e5a0e0803f3612534b62f74 100644 (file)
@@ -107,8 +107,10 @@ static struct dentry *__fh_to_dentry(struct super_block *sb,
                req->r_ino1 = vino;
                req->r_num_caps = 1;
                err = ceph_mdsc_do_request(mdsc, NULL, req);
+               inode = req->r_target_inode;
+               if (inode)
+                       igrab(inode);
                ceph_mdsc_put_request(req);
-               inode = ceph_find_inode(sb, vino);
                if (!inode)
                        return ERR_PTR(-ESTALE);
        }
@@ -163,8 +165,10 @@ static struct dentry *__cfh_to_dentry(struct super_block *sb,
                snprintf(req->r_path2, 16, "%d", cfh->parent_name_hash);
                req->r_num_caps = 1;
                err = ceph_mdsc_do_request(mdsc, NULL, req);
+               inode = req->r_target_inode;
+               if (inode)
+                       igrab(inode);
                ceph_mdsc_put_request(req);
-               inode = ceph_find_inode(sb, vino);
                if (!inode)
                        return ERR_PTR(err ? err : -ESTALE);
        }