From 8f4c223c5f7a7a06c3b73dbb94e85d271bd84fb5 Mon Sep 17 00:00:00 2001 From: Raghavendra Bhat Date: Thu, 17 Jul 2014 12:15:54 +0530 Subject: snapview-server: get the handle if its absent before doing any fop * Now that NFS server does inode linking in readdirp, it can resolve the gfid (i.e. find the right inode from its inode table) present in the filehandle sent by the NFS client on which a fop came. So instead of sending the lookup on that entry, it directly sends the fop. But snapview-server does not get the handle for the entries in readdirp (because doing a lookup on each entry via gfapi would be costly. So it waits till a lookup is done on that inode, to get the handle and the fs instance and fill it in the inode context). So when NFS resoves the gfid and directly sends the fop, snapview-server will not be able to perform the fop as the inode contet would not contain the fs instance and the handle. So fops should check for the handle before doing gfapi calls. If the handle and fs instance are not present in the inode context they should get them by doing an explicit lookup on the entry. rebase of the patch http://review.gluster.org/#/c/8324/ Change-Id: I70c9c8edb2e7ddad79cf6ade3e041b9d02241cd1 BUG: 1143961 Reviewed-on: http://review.gluster.org/8768 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- .../features/snapview-server/src/snapview-server.h | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'xlators/features/snapview-server/src/snapview-server.h') diff --git a/xlators/features/snapview-server/src/snapview-server.h b/xlators/features/snapview-server/src/snapview-server.h index e689e4981a0..4b42aefcd98 100644 --- a/xlators/features/snapview-server/src/snapview-server.h +++ b/xlators/features/snapview-server/src/snapview-server.h @@ -53,6 +53,31 @@ STACK_DESTROY (((call_frame_t *)_frame)->root); \ } while (0) +#define SVS_GET_INODE_CTX_INFO(inode_ctx, fs, object, this, loc, ret, \ + op_errno, label) \ + do { \ + fs = inode_ctx->fs; \ + object = inode_ctx->object; \ + if (!fs || !object) { \ + int32_t tmp = -1; \ + char tmp_uuid[64]; \ + \ + tmp = svs_get_handle (this, loc, inode_ctx, \ + &op_errno); \ + if (tmp) { \ + gf_log (this->name, GF_LOG_ERROR, \ + "failed to get the handle for %s " \ + "(gfid: %s)", loc->path, \ + uuid_utoa_r (loc->inode->gfid, \ + tmp_uuid)); \ + ret = -1; \ + goto label; \ + } \ + \ + fs = inode_ctx->fs; \ + object = inode_ctx->object; \ + } \ + } while(0); int svs_mgmt_submit_request (void *req, call_frame_t *frame, @@ -168,4 +193,8 @@ svs_get_snap_dirent (xlator_t *this, const char *name); int svs_mgmt_init (xlator_t *this); +int32_t +svs_get_handle (xlator_t *this, loc_t *loc, svs_inode_t *inode_ctx, + int32_t *op_errno); + #endif /* __SNAP_VIEW_H__ */ -- cgit