summaryrefslogtreecommitdiffstats
path: root/xlators/protocol
diff options
context:
space:
mode:
authorRaghavendra Bhat <raghavendra@redhat.com>2012-06-01 16:20:19 +0530
committerAnand Avati <avati@redhat.com>2012-06-01 13:09:08 -0700
commit14c88a74175e921a724a747e140b95f2f631bdf4 (patch)
tree22d44143364d55ad61f2603aac7604862b4a26e4 /xlators/protocol
parente8eb0a9cb6539a7607d4c134daf331400a93d136 (diff)
protocol/server: do not wind opendir call if fd creation fails
If resolve fails in some fd based operation, then do not use fd to get gfid (fd might be NULL). Use the gfid present in resolve structure. Change-Id: I1058274a2f9b4e58a76e4e6019e7c5ce1906d365 BUG: 827376 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com> Reviewed-on: http://review.gluster.com/3504 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/protocol')
-rw-r--r--xlators/protocol/server/src/server-resolve.c4
-rw-r--r--xlators/protocol/server/src/server.h2
-rw-r--r--xlators/protocol/server/src/server3_1-fops.c10
3 files changed, 13 insertions, 3 deletions
diff --git a/xlators/protocol/server/src/server-resolve.c b/xlators/protocol/server/src/server-resolve.c
index e44fc2de328..11b48818725 100644
--- a/xlators/protocol/server/src/server-resolve.c
+++ b/xlators/protocol/server/src/server-resolve.c
@@ -422,6 +422,10 @@ out:
if (inode)
inode_unref (inode);
+ if (ret != 0)
+ gf_log ("server", GF_LOG_WARNING, "inode for the gfid (%s) is "
+ "not found. anonymous fd creation failed",
+ uuid_utoa (resolve->gfid));
return ret;
}
diff --git a/xlators/protocol/server/src/server.h b/xlators/protocol/server/src/server.h
index 94ceafd10cc..ee5f8773edd 100644
--- a/xlators/protocol/server/src/server.h
+++ b/xlators/protocol/server/src/server.h
@@ -137,7 +137,7 @@ struct resolve_comp {
typedef struct {
server_resolve_type_t type;
- uint64_t fd_no;
+ int64_t fd_no;
u_char gfid[16];
u_char pargfid[16];
char *path;
diff --git a/xlators/protocol/server/src/server3_1-fops.c b/xlators/protocol/server/src/server3_1-fops.c
index 316e4adb945..b0acd935fe5 100644
--- a/xlators/protocol/server/src/server3_1-fops.c
+++ b/xlators/protocol/server/src/server3_1-fops.c
@@ -670,7 +670,7 @@ server_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
gf_log (this->name, GF_LOG_INFO,
"%"PRId64": READDIR %"PRId64" (%s) ==> (%s)",
frame->root->unique, state->resolve.fd_no,
- uuid_utoa (state->fd->inode->gfid),
+ uuid_utoa (state->resolve.gfid),
strerror (op_errno));
goto out;
}
@@ -1814,7 +1814,7 @@ server_fsetattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
gf_log (this->name, GF_LOG_INFO,
"%"PRId64": FSETATTR %"PRId64" (%s) ==> (%s)",
frame->root->unique, state->resolve.fd_no,
- uuid_utoa (state->fd->inode->gfid),
+ uuid_utoa (state->resolve.gfid),
strerror (op_errno));
goto out;
}
@@ -2330,6 +2330,8 @@ server_readdir_resume (call_frame_t *frame, xlator_t *bound_xl)
if (state->resolve.op_ret != 0)
goto err;
+ GF_ASSERT (state->fd);
+
STACK_WIND (frame, server_readdir_cbk,
bound_xl,
bound_xl->fops->readdir,
@@ -2375,6 +2377,10 @@ server_opendir_resume (call_frame_t *frame, xlator_t *bound_xl)
goto err;
state->fd = fd_create (state->loc.inode, frame->root->pid);
+ if (!state->fd) {
+ gf_log ("server", GF_LOG_ERROR, "could not create the fd");
+ goto err;
+ }
STACK_WIND (frame, server_opendir_cbk,
bound_xl, bound_xl->fops->opendir,