diff options
author | Sachin Pandit <spandit@redhat.com> | 2014-12-19 03:54:45 +0530 |
---|---|---|
committer | Raghavendra Bhat <raghavendra@redhat.com> | 2014-12-24 03:38:51 -0800 |
commit | f47c24d518d1b10bca04a16737dab88bba53a07e (patch) | |
tree | baac60e5dffb68b02a6265c774fe33e09d071caa /xlators/features/snapview-client/src | |
parent | 9f0589646b4932b33ac0a913b1a23d8f279faf2b (diff) |
gluster/uss: Handle ESTALE in snapview client when NFS server restarted
When NFS server is restarted inode-context is lost.
Nameless lookup will be sent to regular volume.
If the gfid is from virtual graph, lookup will fail
with ESTALE. We need to send a lookup to snapview server
Change-Id: I22920614f0d14cb90b53653fce95b6b70023eba6
BUG: 1175736
Signed-off-by: vmallika <vmallika@redhat.com>
Reviewed-on: http://review.gluster.org/9153
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Sachin Pandit <spandit@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Signed-off-by: Sachin Pandit <spandit@redhat.com>
Reviewed-on: http://review.gluster.org/9309
Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
Diffstat (limited to 'xlators/features/snapview-client/src')
-rw-r--r-- | xlators/features/snapview-client/src/snapview-client.c | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/xlators/features/snapview-client/src/snapview-client.c b/xlators/features/snapview-client/src/snapview-client.c index 5f58422c32e..ea0feeaf4b2 100644 --- a/xlators/features/snapview-client/src/snapview-client.c +++ b/xlators/features/snapview-client/src/snapview-client.c @@ -147,16 +147,36 @@ svc_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, is happening on a virtual inode (i.e history data residing in snaps). So if lookup fails with ENOENT and the inode context is not there, then send the lookup to the 2nd child of svc. + + If there are any changes in volfile/client-restarted then inode-ctx + is lost. In this case if nameless lookup fails with ESTALE, + then send the lookup to the 2nd child of svc. */ if (op_ret) { - if (op_errno == ENOENT && + if (subvolume == FIRST_CHILD (this)) { + gf_log (this->name, + (op_errno == ENOENT || op_errno == ESTALE) + ? GF_LOG_DEBUG:GF_LOG_ERROR, + "Lookup failed on normal graph with error %s", + strerror (op_errno)); + } else { + gf_log (this->name, + (op_errno == ENOENT || op_errno == ESTALE) + ? GF_LOG_DEBUG:GF_LOG_ERROR, + "Lookup failed on snapview graph with error %s", + strerror (op_errno)); + } + + if ((op_errno == ENOENT || op_errno == ESTALE) && !uuid_is_null (local->loc.gfid)) { ret = svc_inode_ctx_get (this, inode, &inode_type); if (ret < 0 && subvolume == FIRST_CHILD (this)) { gf_log (this->name, GF_LOG_DEBUG, "Lookup on normal graph failed. " "Sending lookup to snapview-server"); + subvolume = SECOND_CHILD (this); + local->subvolume = subvolume; STACK_WIND (frame, svc_lookup_cbk, subvolume, subvolume->fops->lookup, &local->loc, xdata); @@ -164,18 +184,7 @@ svc_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } } - if (subvolume == FIRST_CHILD (this)) { - gf_log (this->name, - (op_errno == ENOENT)?GF_LOG_DEBUG:GF_LOG_ERROR, - "Lookup failed on normal graph with error %s", - strerror (op_errno)); - } else { - gf_log (this->name, - (op_errno == ENOENT)?GF_LOG_DEBUG:GF_LOG_ERROR, - "Lookup failed on snapview graph with error %s", - strerror (op_errno)); - } - goto out; + goto out; } if (local->loc.parent) |