summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@zresearch.com>2009-04-07 05:33:56 -0700
committerAnand V. Avati <avati@amp.gluster.com>2009-04-08 15:05:30 +0530
commit2524bf2e9cb89627833b1120eac0f78b279c1751 (patch)
tree0f84dda5a53d865152032b392a6419caa45f659b
parent47f03734685076fce51eaacb706796d2213bdbf1 (diff)
libglusterfsclient: Resolve path on empty caches
The earlier case was that the explicit lookups to the server were being sent only when the parent inode was NULL. This situation breaks when the parent inode is available in the i- or d-cache but the child dirent is not. In such a case, no explicit lookups were being sent to get the missing child dirent. Now, explicit path lookup happens even if the inode for parent or basename is not found in the caches. This also fixes a seg-fault occuring during glusterfs_open, in my test case, but one that could occur almost anywhere lookup code is used. Patch adapted from Raghu's original patch. Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
-rw-r--r--libglusterfsclient/src/libglusterfsclient-dentry.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/libglusterfsclient/src/libglusterfsclient-dentry.c b/libglusterfsclient/src/libglusterfsclient-dentry.c
index 9c25e57df..5c8057874 100644
--- a/libglusterfsclient/src/libglusterfsclient-dentry.c
+++ b/libglusterfsclient/src/libglusterfsclient-dentry.c
@@ -431,25 +431,19 @@ libgf_client_path_lookup (loc_t *loc,
goto out;
}
}
- } else {
- gf_log ("libglusterfsclient",
- GF_LOG_DEBUG,
- "resolved path(%s) to %p(%"PRId64")/%p(%"PRId64")",
- loc->path, parent, (parent ? parent->ino : 0),
- inode, (inode ? inode->ino : 0));
- if (parent) {
- inode_unref (parent);
- } else if (inode) {
- inode_unref (inode);
- gf_log ("libglusterfsclient",
- GF_LOG_ERROR,
- "undesired behaviour. inode(%"PRId64") for %s "
- "exists without parent (%s)",
- inode->ino, loc->path, directory);
- }
- op_ret = __do_path_resolve (loc, ctx, lookup_basename);
}
+ if (parent) {
+ inode_unref (parent);
+ } else if (inode) {
+ inode_unref (inode);
+ gf_log ("libglusterfsclient",
+ GF_LOG_ERROR,
+ "undesired behaviour. inode(%"PRId64") for %s "
+ "exists without parent (%s)",
+ inode->ino, loc->path, directory);
+ }
+ op_ret = __do_path_resolve (loc, ctx, lookup_basename);
out:
if (pathname)
free (pathname);