Skip to content

Commit

Permalink
FSAL_CEPH: do an inode lookup vs. MDS when the Inode is not in cache
Browse files Browse the repository at this point in the history
FSAL_CEPH just does a ceph_ll_get_inode when asked to create a
filehandle today, which only does a query of the local Ceph client
cache. This means that it can only find Inodes that were previously
found via name lookup. When ganesha is restarted, we have a blank-slate
Client, and the Inode will not be in cache, so the NFS client can end up
seeing ESTALE errors.

We must be able to find Inodes that may not be in the cache. When
ceph_ll_get_inode can't find an Inode, try a lookup vs. the MDS for it.

The only problem is that we currently have no way to look up a snapped
inode from scratch. I think we'll probably need to add that ability to
libcephfs, but for now the best we can do is just bail out with an
ESTALE in that case.

While we're in there, remove the comment about ceph_ll_connectable_m.
There is no such function in libcephfs and never has been. The ds
code does seem to refer to such a call, but it's not clear to me
what it's supposed to do.

Change-Id: I2d0e362ef8f28ba78575b60f3fb2890096d98fc6
Signed-off-by: Jeff Layton <[email protected]>
Tested-by: "Yan, Zheng" <[email protected]>
  • Loading branch information
jtlayton committed Nov 10, 2017
1 parent 08a953a commit 476c206
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/FSAL/FSAL_CEPH/export.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,23 @@ static fsal_status_t create_handle(struct fsal_export *export_pub,
return status;
}

/* Check our local cache first */
i = ceph_ll_get_inode(export->cmount, *vi);
if (!i)
return ceph2fsal_error(-ESTALE);
if (!i) {
/*
* Try the slow way, may not be in cache now.
*
* Currently, there is no interface for looking up a snapped
* inode, so we just bail here in that case.
*/
if (vi->snapid.val != CEPH_NOSNAP)
return ceph2fsal_error(-ESTALE);

rc = ceph_ll_lookup_inode(export->cmount, vi->ino, &i);
if (rc)
return ceph2fsal_error(rc);
}

/* The ceph_ll_connectable_m should have populated libceph's
cache with all this anyway */
rc = fsal_ceph_ll_getattr(export->cmount, i, &stx,
attrs_out ? CEPH_STATX_ATTR_MASK : CEPH_STATX_HANDLE_MASK,
op_ctx->creds);
Expand Down

0 comments on commit 476c206

Please sign in to comment.