diff options
author | vmallika <vmallika@redhat.com> | 2014-12-03 15:10:44 +0530 |
---|---|---|
committer | Raghavendra Bhat <raghavendra@redhat.com> | 2015-01-08 01:17:13 -0800 |
commit | 1fd314994f0ad581be6723e35eaaeb8126eed700 (patch) | |
tree | 733de218d3a8368d270043d05ad7a33b65228b52 /xlators/features | |
parent | 16ad46dbb925114ba6123ddb2b360f6230b24d89 (diff) |
uss/gluster: Send success on parent lookup of entry-point.
When a lookup sent to snapview-server for entry-point directory
protocol server first tries to resolve gfid of a parent directory.
looking up the parent gfid from a latest snapshot can fail if the
volume is a restored volume. As this gfid is already looked-up by
snapview-client, we can return success for the parent gfid.
Change-Id: Ic9b20561ef79b93032f07c3a81eae54a94e1747b
BUG: 1175744
Signed-off-by: vmallika <vmallika@redhat.com>
Reviewed-on: http://review.gluster.org/9229
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Signed-off-by: Sachin Pandit <spandit@redhat.com>
Reviewed-on: http://review.gluster.org/9342
Diffstat (limited to 'xlators/features')
-rw-r--r-- | xlators/features/snapview-server/src/snapview-server-helpers.c | 2 | ||||
-rw-r--r-- | xlators/features/snapview-server/src/snapview-server.c | 63 |
2 files changed, 51 insertions, 14 deletions
diff --git a/xlators/features/snapview-server/src/snapview-server-helpers.c b/xlators/features/snapview-server/src/snapview-server-helpers.c index a038126eb07..7f03dc47f02 100644 --- a/xlators/features/snapview-server/src/snapview-server-helpers.c +++ b/xlators/features/snapview-server/src/snapview-server-helpers.c @@ -446,7 +446,7 @@ __svs_initialise_snapshot_volume (xlator_t *this, const char *name, dirent = __svs_get_snap_dirent (this, name); if (!dirent) { - gf_log (this->name, GF_LOG_ERROR, "snap entry for " + gf_log (this->name, GF_LOG_DEBUG, "snap entry for " "name %s not found", name); local_errno = ENOENT; goto out; diff --git a/xlators/features/snapview-server/src/snapview-server.c b/xlators/features/snapview-server/src/snapview-server.c index 14fb6f14907..55b51a1e367 100644 --- a/xlators/features/snapview-server/src/snapview-server.c +++ b/xlators/features/snapview-server/src/snapview-server.c @@ -214,9 +214,10 @@ svs_lookup_snapshot (xlator_t *this, loc_t *loc, struct iatt *buf, fs = svs_initialise_snapshot_volume (this, loc->name, op_errno); if (!fs) { - gf_log (this->name, GF_LOG_ERROR, "failed to " + gf_log (this->name, GF_LOG_DEBUG, "failed to " "create the fs instance for snap %s", loc->name); + *op_errno = ENOENT; op_ret = -1; goto out; } @@ -226,7 +227,7 @@ svs_lookup_snapshot (xlator_t *this, loc_t *loc, struct iatt *buf, object = glfs_h_create_from_handle (fs, handle_obj, GFAPI_HANDLE_LENGTH, &statbuf); if (!object) { - gf_log (this->name, GF_LOG_ERROR, "failed to do lookup and " + gf_log (this->name, GF_LOG_DEBUG, "failed to do lookup and " "get the handle on the snapshot %s", loc->name); op_ret = -1; *op_errno = errno; @@ -294,7 +295,7 @@ svs_lookup_entry (xlator_t *this, loc_t *loc, struct iatt *buf, object = glfs_h_lookupat (fs, parent_object, loc->name, &statbuf); if (!object) { - gf_log (this->name, GF_LOG_ERROR, "failed to do lookup and " + gf_log (this->name, GF_LOG_DEBUG, "failed to do lookup and " "get the handle for entry %s (path: %s)", loc->name, loc->path); op_ret = -1; @@ -479,6 +480,7 @@ svs_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) inode_t *parent = NULL; glfs_t *fs = NULL; snap_dirent_t *dirent = NULL; + gf_boolean_t entry_point_key = _gf_false; gf_boolean_t entry_point = _gf_false; GF_VALIDATE_OR_GOTO ("svs", this, out); @@ -507,15 +509,21 @@ svs_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) } } + ret = dict_get_str_boolean (xdata, "entry-point", _gf_false); + if (ret == -1) { + gf_log (this->name, GF_LOG_DEBUG, "failed to get the " + "entry point info"); + entry_point_key = _gf_false; + } else { + entry_point_key = ret; + } + if (loc->name && strlen (loc->name)) { - ret = dict_get_str_boolean (xdata, "entry-point", _gf_false); - if (ret == -1) { - gf_log (this->name, GF_LOG_DEBUG, "failed to get the " - "entry point info"); - entry_point = _gf_false; - } else { - entry_point = ret; - } + /* lookup can come with the entry-point set in the dict + * for the parent directory of the entry-point as well. + * So consider entry_point only for named lookup + */ + entry_point = entry_point_key; } if (loc->parent) @@ -567,8 +575,37 @@ svs_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) the server does not have the inode in the inode table. */ if (!inode_ctx && !parent_ctx) { - op_ret = svs_lookup_gfid (this, loc, &buf, &postparent, - &op_errno); + if (uuid_is_null (loc->gfid) && + uuid_is_null (loc->inode->gfid)) { + gf_log (this->name, GF_LOG_ERROR, "gfid is NULL"); + op_ret = -1; + op_errno = ESTALE; + goto out; + } + + if (!entry_point_key) { + /* This can happen when there is no inode_ctx available. + * snapview-server might have restarted or + * graph change might have happened + */ + op_ret = -1; + op_errno = ESTALE; + goto out; + } + + /* lookup is on the parent directory of entry-point. + * this would have already looked up by snap-view client + * so return success + */ + if (!uuid_is_null (loc->gfid)) + uuid_copy (buf.ia_gfid, loc->gfid); + else + uuid_copy (buf.ia_gfid, loc->inode->gfid); + + svs_iatt_fill (buf.ia_gfid, &buf); + svs_iatt_fill (buf.ia_gfid, &postparent); + + op_ret = 0; goto out; } |