summaryrefslogtreecommitdiffstats
path: root/xlators/features
diff options
context:
space:
mode:
authorvmallika <vmallika@redhat.com>2014-12-03 15:10:44 +0530
committerVijay Bellur <vbellur@redhat.com>2014-12-05 03:22:20 -0800
commit80fa3559583ac2c45e4dda9a26272090cd72f1bb (patch)
tree98f96fb4c8436d216949655e9463fbf6e1f9043a /xlators/features
parent5fdffa7164ffc5a798246411d065259b36658bc3 (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: 1162498 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>
Diffstat (limited to 'xlators/features')
-rw-r--r--xlators/features/snapview-server/src/snapview-server-helpers.c2
-rw-r--r--xlators/features/snapview-server/src/snapview-server.c63
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;
}