summaryrefslogtreecommitdiffstats
path: root/api/src/glfs-resolve.c
diff options
context:
space:
mode:
Diffstat (limited to 'api/src/glfs-resolve.c')
-rw-r--r--api/src/glfs-resolve.c34
1 files changed, 27 insertions, 7 deletions
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;