summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorVikas Gorur <vikas@gluster.com>2009-10-13 06:42:13 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-10-13 06:23:03 -0700
commit7d6e73d4421265a304fd22964649e555a2db8097 (patch)
tree34010785707512f3cdd6d57d33d1baf77a10682b /xlators
parentf085beebd03b2c8be2fa57039ad3cbcb6eaa66d3 (diff)
posix/client/server: Send postparent in lookup even if lookup fails on the entry itself.
Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 137 (Parent directory mtime not reset after a create in self-heal) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=137
Diffstat (limited to 'xlators')
-rw-r--r--xlators/protocol/client/src/client-protocol.c5
-rw-r--r--xlators/protocol/server/src/server-protocol.c4
-rw-r--r--xlators/storage/posix/src/posix.c8
3 files changed, 12 insertions, 5 deletions
diff --git a/xlators/protocol/client/src/client-protocol.c b/xlators/protocol/client/src/client-protocol.c
index a798ea9f7..a7dbfbf53 100644
--- a/xlators/protocol/client/src/client-protocol.c
+++ b/xlators/protocol/client/src/client-protocol.c
@@ -4609,10 +4609,11 @@ client_lookup_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen,
op_ret = ntoh32 (hdr->rsp.op_ret);
+ gf_stat_to_stat (&rsp->postparent, &postparent);
+
if (op_ret == 0) {
op_ret = -1;
gf_stat_to_stat (&rsp->stat, &stbuf);
- gf_stat_to_stat (&rsp->postparent, &postparent);
ret = inode_ctx_get (inode, frame->this, &oldino);
if (oldino != stbuf.st_ino) {
@@ -4664,7 +4665,7 @@ client_lookup_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen,
}
gf_errno = ntoh32 (hdr->rsp.op_errno);
op_errno = gf_error_to_errno (gf_errno);
-
+
fail:
STACK_UNWIND (frame, op_ret, op_errno, inode, &stbuf, xattr,
&postparent);
diff --git a/xlators/protocol/server/src/server-protocol.c b/xlators/protocol/server/src/server-protocol.c
index a6017d236..3568a7232 100644
--- a/xlators/protocol/server/src/server-protocol.c
+++ b/xlators/protocol/server/src/server-protocol.c
@@ -2190,6 +2190,9 @@ server_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
gf_errno = gf_errno_to_error (op_errno);
hdr->rsp.op_errno = hton32 (gf_errno);
+ if (postparent)
+ gf_stat_from_stat (&rsp->postparent, postparent);
+
if (op_ret == 0) {
root_inode = BOUND_XL(frame)->itable->root;
if (inode == root_inode) {
@@ -2200,7 +2203,6 @@ server_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
gf_stat_from_stat (&rsp->stat, stbuf);
- gf_stat_from_stat (&rsp->postparent, postparent);
if (inode->ino == 0) {
inode_link (inode, state->loc.parent,
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index fa70dd274..6f9886af4 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -306,6 +306,7 @@ posix_lookup (call_frame_t *frame, xlator_t *this,
struct stat buf = {0, };
char * real_path = NULL;
int32_t op_ret = -1;
+ int32_t entry_ret = 0;
int32_t op_errno = 0;
dict_t * xattr = NULL;
char * pathdup = NULL;
@@ -331,7 +332,9 @@ posix_lookup (call_frame_t *frame, xlator_t *this,
"lstat on %s failed: %s",
loc->path, strerror (op_errno));
}
- goto out;
+
+ entry_ret = -1;
+ goto parent;
}
/* Make sure we don't access another mountpoint inside export dir.
@@ -362,6 +365,7 @@ posix_lookup (call_frame_t *frame, xlator_t *this,
xattr_req, &buf);
}
+parent:
pathdup = strdup (real_path);
GF_VALIDATE_OR_GOTO (this->name, pathdup, out);
@@ -376,7 +380,7 @@ posix_lookup (call_frame_t *frame, xlator_t *this,
goto out;
}
- op_ret = 0;
+ op_ret = entry_ret;
out:
if (pathdup)
FREE (pathdup);