summaryrefslogtreecommitdiffstats
path: root/xlators/protocol
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:56 -0700
commit45883c74f2c3b11b77fa94be714341ccf0e21198 (patch)
tree53d3d49626399d4d9fa426885fabdbcfd3ae9c61 /xlators/protocol
parentb4d6c3d1bb461d2c8a396c9ed3881a4da40fc6ab (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>
Diffstat (limited to 'xlators/protocol')
-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 47a6f027736..09b35c44f03 100644
--- a/xlators/protocol/server/src/server-protocol.c
+++ b/xlators/protocol/server/src/server-protocol.c
@@ -2500,32 +2500,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);