summaryrefslogtreecommitdiffstats
path: root/api/src/glfs-resolve.c
diff options
context:
space:
mode:
authorMohammed Rafi KC <rkavunga@redhat.com>2016-01-12 15:04:46 +0530
committerDan Lambright <dlambrig@redhat.com>2016-01-13 19:27:45 -0800
commit252fe523e2932e83a98f203f71678f391eee6b22 (patch)
tree62004e2dc61ff34e2e531f4ed1fb7d7ae30dd8a8 /api/src/glfs-resolve.c
parentad8c65612d6d7e32c06fd3aed11b7a9edd514607 (diff)
gfapi: send lookup if inode_ctx is not set
During resolving of an entry or inode, if inode ctx was not set, we will send a lookup to pupulate inode ctx for every xlators This patch also make sure that inode_ctx will be created after every inode_link. We will store inode_ctx value as LOOKUP_NEEDED if the inode is liked via readdirp, in all other case we will store inode_ctx value as LOOKUP_NOT_NEEDED. Change-Id: I3a10c298944200fa3862127187ae8988e582d352 BUG: 1297311 Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com> Reviewed-on: http://review.gluster.org/13226 Reviewed-by: Poornima G <pgurusid@redhat.com> Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com> Reviewed-by: Dan Lambright <dlambrig@redhat.com> Tested-by: Dan Lambright <dlambrig@redhat.com>
Diffstat (limited to 'api/src/glfs-resolve.c')
-rw-r--r--api/src/glfs-resolve.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/api/src/glfs-resolve.c b/api/src/glfs-resolve.c
index 65fe590144d..9d8ea2c4553 100644
--- a/api/src/glfs-resolve.c
+++ b/api/src/glfs-resolve.c
@@ -86,6 +86,7 @@ glfs_refresh_inode_safe (xlator_t *subvol, inode_t *oldinode,
struct iatt iatt = {0, };
inode_t *newinode = NULL;
gf_boolean_t lookup_needed = _gf_false;
+ uint64_t ctx_value = LOOKUP_NOT_NEEDED;
if (!oldinode)
@@ -124,8 +125,11 @@ glfs_refresh_inode_safe (xlator_t *subvol, inode_t *oldinode,
}
newinode = inode_link (loc.inode, 0, 0, &iatt);
- if (newinode)
- inode_lookup (newinode);
+ if (newinode) {
+ if (newinode == loc.inode)
+ inode_ctx_set (newinode, THIS, &ctx_value);
+ inode_lookup (newinode);
+ }
loc_wipe (&loc);
@@ -235,6 +239,7 @@ glfs_resolve_component (struct glfs *fs, xlator_t *subvol, inode_t *parent,
struct iatt ciatt = {0, };
uuid_t gfid;
dict_t *xattr_req = NULL;
+ uint64_t ctx_value = LOOKUP_NOT_NEEDED;
loc.name = component;
@@ -265,7 +270,7 @@ glfs_resolve_component (struct glfs *fs, xlator_t *subvol, inode_t *parent,
gf_uuid_copy (loc.gfid, loc.inode->gfid);
reval = 1;
- if (!force_lookup) {
+ if (!(force_lookup || inode_needs_lookup (loc.inode, THIS))) {
inode = inode_ref (loc.inode);
ciatt.ia_type = inode->ia_type;
goto found;
@@ -336,6 +341,8 @@ glfs_resolve_component (struct glfs *fs, xlator_t *subvol, inode_t *parent,
goto out;
inode = inode_link (loc.inode, loc.parent, component, &ciatt);
+ if (inode == loc.inode)
+ inode_ctx_set (inode, THIS, &ctx_value);
found:
if (inode)
inode_lookup (inode);