diff options
| author | Sage Weil <sage@newdream.net> | 2011-04-06 12:31:40 -0400 |
|---|---|---|
| committer | Sage Weil <sage@newdream.net> | 2011-05-24 14:52:05 -0400 |
| commit | 3c454cf21645bc96668e286f6352ac2c4c895fa2 (patch) | |
| tree | 9ad5d408a07819d3e1155fb98df44c92f86a0eb5 | |
| parent | aedfec59eed37d1ff7ce09b303b668234e9a7f8e (diff) | |
ceph: use LOOKUPINO to make unconnected nfs fh more reliable
If we are unable to locate an inode by ino, ask the MDS using the new
LOOKUPINO command.
Signed-off-by: Sage Weil <sage@newdream.net>
| -rw-r--r-- | fs/ceph/export.c | 19 | ||||
| -rw-r--r-- | include/linux/ceph/ceph_fs.h | 1 |
2 files changed, 18 insertions, 2 deletions
diff --git a/fs/ceph/export.c b/fs/ceph/export.c index e41056174bf8..f1828af09912 100644 --- a/fs/ceph/export.c +++ b/fs/ceph/export.c | |||
| @@ -86,6 +86,7 @@ static int ceph_encode_fh(struct dentry *dentry, u32 *rawfh, int *max_len, | |||
| 86 | static struct dentry *__fh_to_dentry(struct super_block *sb, | 86 | static struct dentry *__fh_to_dentry(struct super_block *sb, |
| 87 | struct ceph_nfs_fh *fh) | 87 | struct ceph_nfs_fh *fh) |
| 88 | { | 88 | { |
| 89 | struct ceph_mds_client *mdsc = ceph_sb_to_client(sb)->mdsc; | ||
| 89 | struct inode *inode; | 90 | struct inode *inode; |
| 90 | struct dentry *dentry; | 91 | struct dentry *dentry; |
| 91 | struct ceph_vino vino; | 92 | struct ceph_vino vino; |
| @@ -95,8 +96,22 @@ static struct dentry *__fh_to_dentry(struct super_block *sb, | |||
| 95 | vino.ino = fh->ino; | 96 | vino.ino = fh->ino; |
| 96 | vino.snap = CEPH_NOSNAP; | 97 | vino.snap = CEPH_NOSNAP; |
| 97 | inode = ceph_find_inode(sb, vino); | 98 | inode = ceph_find_inode(sb, vino); |
| 98 | if (!inode) | 99 | if (!inode) { |
| 99 | return ERR_PTR(-ESTALE); | 100 | struct ceph_mds_request *req; |
| 101 | |||
| 102 | req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_LOOKUPINO, | ||
| 103 | USE_ANY_MDS); | ||
| 104 | if (IS_ERR(req)) | ||
| 105 | return ERR_CAST(req); | ||
| 106 | |||
| 107 | req->r_ino1 = vino; | ||
| 108 | req->r_num_caps = 1; | ||
| 109 | err = ceph_mdsc_do_request(mdsc, NULL, req); | ||
| 110 | ceph_mdsc_put_request(req); | ||
| 111 | inode = ceph_find_inode(sb, vino); | ||
| 112 | if (!inode) | ||
| 113 | return ERR_PTR(-ESTALE); | ||
| 114 | } | ||
| 100 | 115 | ||
| 101 | dentry = d_obtain_alias(inode); | 116 | dentry = d_obtain_alias(inode); |
| 102 | if (IS_ERR(dentry)) { | 117 | if (IS_ERR(dentry)) { |
diff --git a/include/linux/ceph/ceph_fs.h b/include/linux/ceph/ceph_fs.h index b8e995fbd867..b8c60694b2b0 100644 --- a/include/linux/ceph/ceph_fs.h +++ b/include/linux/ceph/ceph_fs.h | |||
| @@ -313,6 +313,7 @@ enum { | |||
| 313 | CEPH_MDS_OP_GETATTR = 0x00101, | 313 | CEPH_MDS_OP_GETATTR = 0x00101, |
| 314 | CEPH_MDS_OP_LOOKUPHASH = 0x00102, | 314 | CEPH_MDS_OP_LOOKUPHASH = 0x00102, |
| 315 | CEPH_MDS_OP_LOOKUPPARENT = 0x00103, | 315 | CEPH_MDS_OP_LOOKUPPARENT = 0x00103, |
| 316 | CEPH_MDS_OP_LOOKUPINO = 0x00104, | ||
| 316 | 317 | ||
| 317 | CEPH_MDS_OP_SETXATTR = 0x01105, | 318 | CEPH_MDS_OP_SETXATTR = 0x01105, |
| 318 | CEPH_MDS_OP_RMXATTR = 0x01106, | 319 | CEPH_MDS_OP_RMXATTR = 0x01106, |
