summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorSoumya Koduri <skoduri@redhat.com>2014-06-04 18:40:00 +0530
committerVijay Bellur <vbellur@redhat.com>2014-07-16 04:48:20 -0700
commit119109e95268061d9a68c09972302c35a1b22201 (patch)
tree0ae9638a2dd83d4aee2a5e941ebda8ad8a84d92e /api
parent1dea949cb60c3814c9206df6ba8dddec8d471a94 (diff)
libgfapi: Fixed an issue with healing files during glfs_resolve
While resolving any path during the first lookup, libgfapi should generate and send gfid as well along with the new inode created to the syncop_lookup(..) so that POSIX translator can heal the files with missing gfid using the new gfid passed. This wasn't happening correctly in the current "glfs_resolve_component(..)" implementation. Fixed the same. Also have added the changes from http://review.gluster.org/5337 in libgfapi, which is a fix to unlink the inode on revalidate if entry not found. In addition to the above, have cleaned up a redundant gfapi log mesage. Change-Id: I0757dda782d16ba6bdbe7ebdbde9c43381229b0a BUG: 1116854 Signed-off-by: Soumya Koduri <skoduri@redhat.com> Reviewed-on: http://review.gluster.org/7976 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Poornima G <pgurusid@redhat.com> Reviewed-by: Raghavendra G <rgowdapp@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'api')
-rw-r--r--api/src/glfs-mgmt.c2
-rw-r--r--api/src/glfs-resolve.c34
2 files changed, 27 insertions, 9 deletions
diff --git a/api/src/glfs-mgmt.c b/api/src/glfs-mgmt.c
index bac51ceee59..3a428c9d95a 100644
--- a/api/src/glfs-mgmt.c
+++ b/api/src/glfs-mgmt.c
@@ -362,8 +362,6 @@ done:
memcpy (volid, fs->vol_uuid, uuid_size);
- gf_log (THIS->name, GF_LOG_INFO, "volume uuid: %s", volid);
-
return uuid_size;
}
diff --git a/api/src/glfs-resolve.c b/api/src/glfs-resolve.c
index fd0ed757ffe..7ed45169a25 100644
--- a/api/src/glfs-resolve.c
+++ b/api/src/glfs-resolve.c
@@ -264,10 +264,24 @@ glfs_resolve_component (struct glfs *fs, xlator_t *subvol, inode_t *parent,
} else {
uuid_generate (gfid);
loc.inode = inode_new (parent->table);
- }
+ if (!loc.inode) {
+ errno = ENOMEM;
+ goto out;
+ }
- if (!loc.inode)
- goto out;
+ xattr_req = dict_new ();
+ if (!xattr_req) {
+ errno = ENOMEM;
+ goto out;
+ }
+
+ ret = dict_set_static_bin (xattr_req, "gfid-req", gfid, 16);
+ if (ret) {
+ errno = ENOMEM;
+ goto out;
+ }
+
+ }
glret = glfs_loc_touchup (&loc);
if (glret < 0) {
@@ -275,9 +289,15 @@ glfs_resolve_component (struct glfs *fs, xlator_t *subvol, inode_t *parent,
goto out;
}
- ret = syncop_lookup (subvol, &loc, NULL, &ciatt, NULL, NULL);
- DECODE_SYNCOP_ERR (ret);
- if (ret && reval) {
+ ret = syncop_lookup (subvol, &loc, xattr_req, &ciatt, NULL, NULL);
+ if (ret && reval) {
+ /*
+ * A stale mapping might exist for a dentry/inode that has been
+ * removed from another client.
+ */
+ if (-ret == ENOENT)
+ inode_unlink(loc.inode, loc.parent,
+ loc.name);
inode_unref (loc.inode);
loc.inode = inode_new (parent->table);
if (!loc.inode) {
@@ -301,8 +321,8 @@ glfs_resolve_component (struct glfs *fs, xlator_t *subvol, inode_t *parent,
ret = syncop_lookup (subvol, &loc, xattr_req, &ciatt,
NULL, NULL);
- DECODE_SYNCOP_ERR (ret);
}
+ DECODE_SYNCOP_ERR (ret);
if (ret)
goto out;