diff options
-rw-r--r-- | xlators/protocol/client/src/client-protocol.c | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/xlators/protocol/client/src/client-protocol.c b/xlators/protocol/client/src/client-protocol.c index 3adfbd79b74..7ba766271ba 100644 --- a/xlators/protocol/client/src/client-protocol.c +++ b/xlators/protocol/client/src/client-protocol.c @@ -713,6 +713,7 @@ client_create (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, "CREATE %"PRId64"/%s (%s): failed to get remote inode " "number for parent inode", loc->parent->ino, loc->name, loc->path); + goto unwind; } hdrlen = gf_hdr_len (req, pathlen + baselen); @@ -783,6 +784,7 @@ client_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, "OPEN %"PRId64" (%s): " "failed to get remote inode number", loc->inode->ino, loc->path); + goto unwind; } hdrlen = gf_hdr_len (req, pathlen); @@ -840,6 +842,7 @@ client_stat (call_frame_t *frame, xlator_t *this, loc_t *loc) "STAT %"PRId64" (%s): " "failed to get remote inode number", loc->inode->ino, loc->path); + goto unwind; } hdrlen = gf_hdr_len (req, pathlen); @@ -895,6 +898,7 @@ client_readlink (call_frame_t *frame, xlator_t *this, loc_t *loc, size_t size) "READLINK %"PRId64" (%s): " "failed to get remote inode number", loc->inode->ino, loc->path); + goto unwind; } hdrlen = gf_hdr_len (req, pathlen); @@ -962,6 +966,7 @@ client_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, "MKNOD %"PRId64"/%s (%s): failed to get remote inode " "number for parent", loc->parent->ino, loc->name, loc->path); + goto unwind; } hdrlen = gf_hdr_len (req, pathlen + baselen); @@ -1029,6 +1034,7 @@ client_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode) "MKDIR %"PRId64"/%s (%s): failed to get remote inode " "number for parent", loc->parent->ino, loc->name, loc->path); + goto unwind; } hdrlen = gf_hdr_len (req, pathlen + baselen); @@ -1086,6 +1092,7 @@ client_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc) "UNLINK %"PRId64"/%s (%s): failed to get remote inode " "number for parent", loc->parent->ino, loc->name, loc->path); + goto unwind; } hdrlen = gf_hdr_len (req, pathlen + baselen); @@ -1142,6 +1149,7 @@ client_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc) "RMDIR %"PRId64"/%s (%s): failed to get remote inode " "number for parent", loc->parent->ino, loc->name, loc->path); + goto unwind; } hdrlen = gf_hdr_len (req, pathlen + baselen); @@ -1211,6 +1219,7 @@ client_symlink (call_frame_t *frame, xlator_t *this, const char *linkname, "SYMLINK %"PRId64"/%s (%s): failed to get remote inode" " number parent", loc->parent->ino, loc->name, loc->path); + goto unwind; } hdrlen = gf_hdr_len (req, pathlen + baselen + newlen); @@ -1275,6 +1284,7 @@ client_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc, "RENAME %"PRId64"/%s (%s): failed to get remote inode " "number for source parent", oldloc->parent->ino, oldloc->name, oldloc->path); + goto unwind; } ret = inode_ctx_get2 (newloc->parent, this, &newpar, &newgen); @@ -1283,6 +1293,7 @@ client_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc, "CREATE %"PRId64"/%s (%s): failed to get remote inode " "number for destination parent", newloc->parent->ino, newloc->name, newloc->path); + goto unwind; } hdrlen = gf_hdr_len (req, (oldpathlen + oldbaselen + @@ -1362,6 +1373,7 @@ client_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc) "failed to get remote inode number for source inode", newloc->parent->ino, newloc->name, newloc->path, oldloc->ino, oldloc->path); + goto unwind; } ret = inode_ctx_get2 (newloc->parent, this, &newpar, &newgen); @@ -1371,6 +1383,7 @@ client_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc) "failed to get remote inode number destination parent", newloc->parent->ino, newloc->name, newloc->path, oldloc->ino, oldloc->path); + goto unwind; } hdrlen = gf_hdr_len (req, oldpathlen + newpathlen + newbaselen); @@ -1429,6 +1442,7 @@ client_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset) "TRUNCATE %"PRId64" (%s): " "failed to get remote inode number", loc->inode->ino, loc->path); + goto unwind; } hdrlen = gf_hdr_len (req, pathlen); @@ -1492,7 +1506,7 @@ client_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, gf_log (this->name, GF_LOG_TRACE, "(%"PRId64"): failed to get fd ctx, EBADFD", fd->inode->ino); - STACK_UNWIND (frame, -1, EINVAL, NULL, 0, NULL); + STACK_UNWIND (frame, -1, EBADFD, NULL, 0, NULL); return 0; } @@ -1632,6 +1646,7 @@ client_statfs (call_frame_t *frame, xlator_t *this, loc_t *loc) "STATFS %"PRId64" (%s): " "failed to get remote inode number", loc->inode->ino, loc->path); + goto unwind; } } @@ -1832,6 +1847,7 @@ client_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc, "XATTROP %"PRId64" (%s): " "failed to get remote inode number", loc->inode->ino, loc->path); + goto unwind; } hdrlen = gf_hdr_len (req, dict_len + pathlen); @@ -1989,6 +2005,7 @@ client_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, "SETXATTR %"PRId64" (%s): " "failed to get remote inode number", loc->inode->ino, loc->path); + goto unwind; } hdrlen = gf_hdr_len (req, dict_len + pathlen); @@ -2148,6 +2165,7 @@ client_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, "GETXATTR %"PRId64" (%s): " "failed to get remote inode number", loc->inode->ino, loc->path); + goto unwind; } hdrlen = gf_hdr_len (req, pathlen + namelen); @@ -2288,6 +2306,7 @@ client_removexattr (call_frame_t *frame, xlator_t *this, loc_t *loc, "REMOVEXATTR %"PRId64" (%s): " "failed to get remote inode number", loc->inode->ino, loc->path); + goto unwind; } hdrlen = gf_hdr_len (req, pathlen + namelen); @@ -2349,6 +2368,7 @@ client_opendir (call_frame_t *frame, xlator_t *this, loc_t *loc, "OPENDIR %"PRId64" (%s): " "failed to get remote inode number", loc->inode->ino, loc->path); + goto unwind; } pathlen = STRLEN_0 (loc->path); @@ -2670,6 +2690,7 @@ client_access (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t mask) "ACCESS %"PRId64" (%s): " "failed to get remote inode number", loc->inode->ino, loc->path); + goto unwind; } pathlen = STRLEN_0 (loc->path); @@ -2967,6 +2988,7 @@ client_inodelk (call_frame_t *frame, xlator_t *this, const char *volume, "INODELK %"PRId64" (%s): " "failed to get remote inode number", loc->inode->ino, loc->path); + goto unwind; } if (cmd == F_GETLK || cmd == F_GETLK64) @@ -3159,6 +3181,7 @@ client_entrylk (call_frame_t *frame, xlator_t *this, const char *volume, "ENTRYLK %"PRId64" (%s): " "failed to get remote inode number", loc->inode->ino, loc->path); + goto unwind; } hdrlen = gf_hdr_len (req, pathlen + vollen + namelen); @@ -3316,6 +3339,7 @@ client_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, "LOOKUP %"PRId64"/%s (%s): failed to get " "remote inode number for parent", loc->parent->ino, loc->name, loc->path); + goto unwind; } GF_VALIDATE_OR_GOTO (this->name, loc->name, unwind); baselen = STRLEN_0 (loc->name); @@ -3541,6 +3565,7 @@ client_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, "SETATTR %"PRId64" (%s): " "failed to get remote inode number", loc->inode->ino, loc->path); + goto unwind; } hdrlen = gf_hdr_len (req, pathlen); @@ -3981,6 +4006,9 @@ client_create_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, "remote inode number to inode ctx", local->loc.parent->ino, local->loc.name, local->loc.path); + op_ret = -1; + op_errno = EINVAL; + goto unwind_out; } fdctx = CALLOC (1, sizeof (*fdctx)); @@ -4168,6 +4196,9 @@ client_mknod_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, " inode number to inode ctx", local->loc.parent->ino, local->loc.name, local->loc.path); + STACK_UNWIND (frame, -1, EINVAL, inode, NULL, + NULL, NULL); + return 0; } gf_stat_to_stat (&rsp->preparent, &preparent); @@ -4224,6 +4255,9 @@ client_symlink_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, "remote inode number to inode ctx", local->loc.parent->ino, local->loc.name, local->loc.path); + STACK_UNWIND (frame, -1, EINVAL, inode, NULL, + NULL, NULL); + return 0; } gf_stat_to_stat (&rsp->preparent, &preparent); gf_stat_to_stat (&rsp->postparent, &postparent); @@ -4697,6 +4731,9 @@ client_mkdir_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, "remote inode number to inode ctx", local->loc.parent->ino, local->loc.name, local->loc.path); + STACK_UNWIND (frame, -1, EINVAL, inode, NULL, + NULL, NULL); + return 0; } gf_stat_to_stat (&rsp->preparent, &preparent); @@ -4942,6 +4979,8 @@ client_lookup_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, local->loc.parent->ino : (uint64_t) 0, local->loc.name, local->loc.path); + op_errno = EINVAL; + goto fail; } } @@ -5685,6 +5724,8 @@ client_checksum (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flag) "CHECKSUM %"PRId64" (%s): " "failed to get remote inode number", loc->inode->ino, loc->path); + STACK_UNWIND (frame, -1, EINVAL, NULL, NULL); + return 0; } req->ino = hton64 (ino); |