summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKrishna Srinivas <krishna@gluster.com>2009-08-16 14:34:08 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-08-19 17:57:57 -0700
commit0187de2869f03614f99e61adf9c88f3e0bfb307d (patch)
tree30ccb69e4fca677f6b3b6ae5e062be4ac5d96a3a
parent86f2f049902315b6ae833b54731699a801f9374b (diff)
in server_rename if we do_path_lookup on the newloc and parent directory is not found, the server crashes.
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
-rw-r--r--xlators/protocol/server/src/server-protocol.c52
1 files changed, 28 insertions, 24 deletions
diff --git a/xlators/protocol/server/src/server-protocol.c b/xlators/protocol/server/src/server-protocol.c
index 92ef6cfac..3bfffd700 100644
--- a/xlators/protocol/server/src/server-protocol.c
+++ b/xlators/protocol/server/src/server-protocol.c
@@ -2529,32 +2529,36 @@ server_stub_resume (call_stub_t *stub, int32_t op_ret, int32_t op_errno,
switch (stub->fop)
{
case GF_FOP_RENAME:
+ if ((op_ret < 0 && stub->args.rename.old.inode == NULL) ||
+ (op_ret < 0 && parent == NULL)) {
+ /* Either oldloc lookup failed OR newloc lookup
+ * failed and parent was not found
+ */
+ gf_log (stub->frame->this->name, GF_LOG_DEBUG,
+ "%"PRId64": RENAME (%s -> %s) on %s "
+ "returning error: "
+ "%"PRId32" (%"PRId32")",
+ stub->frame->root->unique,
+ stub->args.rename.old.path,
+ stub->args.rename.new.path,
+ BOUND_XL(stub->frame)->name,
+ op_ret, op_errno);
+
+ /* lookup of oldpath failed, UNWIND to
+ * server_rename_cbk with ret=-1 and
+ * errno=ENOENT
+ */
+ server_rename_cbk (stub->frame, NULL,
+ stub->frame->this,
+ -1, ENOENT, NULL);
+ server_loc_wipe (&stub->args.rename.old);
+ server_loc_wipe (&stub->args.rename.new);
+ FREE (stub);
+ return 0;
+ }
+
if (stub->args.rename.old.inode == NULL) {
/* now we are called by lookup of oldpath. */
- if (op_ret < 0) {
- gf_log (stub->frame->this->name, GF_LOG_DEBUG,
- "%"PRId64": RENAME (%s -> %s) on %s "
- "returning error: "
- "%"PRId32" (%"PRId32")",
- stub->frame->root->unique,
- stub->args.rename.old.path,
- stub->args.rename.new.path,
- BOUND_XL(stub->frame)->name,
- op_ret, op_errno);
-
- /* lookup of oldpath failed, UNWIND to
- * server_rename_cbk with ret=-1 and
- * errno=ENOENT
- */
- server_rename_cbk (stub->frame, NULL,
- stub->frame->this,
- -1, ENOENT, NULL);
- server_loc_wipe (&stub->args.rename.old);
- server_loc_wipe (&stub->args.rename.new);
- FREE (stub);
- return 0;
- }
-
if (stub->args.rename.old.parent == NULL)
stub->args.rename.old.parent =
inode_ref (parent);