From f08a2073d58ffff8c5b358fbb05702377a251b87 Mon Sep 17 00:00:00 2001 From: "Anand V. Avati" Date: Sun, 6 Dec 2009 11:34:07 -0800 Subject: Revert "protocol/client: return ENOENT if inode context is missing" This reverts commit 4439876a34f2e5d19db0d8b05ce7d7722c1c466f. This revert is necessary for path handle resolution to work over the protocol where client/server talk only with the path, without inode or parent inode and generation numbers --- xlators/protocol/client/src/client-protocol.c | 70 ++++++++------------------- 1 file changed, 21 insertions(+), 49 deletions(-) diff --git a/xlators/protocol/client/src/client-protocol.c b/xlators/protocol/client/src/client-protocol.c index 43c55d740..9deb691e8 100644 --- a/xlators/protocol/client/src/client-protocol.c +++ b/xlators/protocol/client/src/client-protocol.c @@ -692,7 +692,6 @@ 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); @@ -716,7 +715,7 @@ client_create (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, unwind: if (hdr) free (hdr); - STACK_UNWIND (frame, -1, ENOENT, fd, NULL, NULL); + STACK_UNWIND (frame, -1, EINVAL, fd, NULL, NULL); return 0; } @@ -763,7 +762,6 @@ 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); @@ -787,7 +785,7 @@ client_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, unwind: if (hdr) free (hdr); - STACK_UNWIND (frame, -1, ENOENT, fd); + STACK_UNWIND (frame, -1, EINVAL, fd); return 0; } @@ -821,7 +819,6 @@ 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); @@ -843,7 +840,7 @@ client_stat (call_frame_t *frame, xlator_t *this, loc_t *loc) unwind: if (hdr) free (hdr); - STACK_UNWIND (frame, -1, ENOENT, NULL); + STACK_UNWIND (frame, -1, EINVAL, NULL); return 0; } @@ -877,7 +874,6 @@ 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); @@ -900,7 +896,7 @@ client_readlink (call_frame_t *frame, xlator_t *this, loc_t *loc, size_t size) unwind: if (hdr) free (hdr); - STACK_UNWIND (frame, -1, ENOENT, NULL); + STACK_UNWIND (frame, -1, EINVAL, NULL); return 0; } @@ -945,7 +941,6 @@ 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); @@ -970,7 +965,7 @@ client_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, unwind: if (hdr) free (hdr); - STACK_UNWIND (frame, -1, ENOENT, loc->inode, NULL); + STACK_UNWIND (frame, -1, EINVAL, loc->inode, NULL); return 0; } @@ -1013,7 +1008,6 @@ 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); @@ -1037,7 +1031,7 @@ client_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode) unwind: if (hdr) free (hdr); - STACK_UNWIND (frame, -1, ENOENT, loc->inode, NULL); + STACK_UNWIND (frame, -1, EINVAL, loc->inode, NULL); return 0; } @@ -1071,7 +1065,6 @@ 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); @@ -1094,7 +1087,7 @@ client_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc) unwind: if (hdr) free (hdr); - STACK_UNWIND (frame, -1, ENOENT); + STACK_UNWIND (frame, -1, EINVAL); return 0; } @@ -1128,7 +1121,6 @@ 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); @@ -1151,7 +1143,7 @@ client_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc) unwind: if (hdr) free (hdr); - STACK_UNWIND (frame, -1, ENOENT); + STACK_UNWIND (frame, -1, EINVAL); return 0; } @@ -1198,7 +1190,6 @@ 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); @@ -1221,7 +1212,7 @@ client_symlink (call_frame_t *frame, xlator_t *this, const char *linkname, unwind: if (hdr) free (hdr); - STACK_UNWIND (frame, -1, ENOENT, loc->inode, NULL); + STACK_UNWIND (frame, -1, EINVAL, loc->inode, NULL); return 0; } @@ -1263,7 +1254,6 @@ 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); @@ -1302,7 +1292,7 @@ client_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc, unwind: if (hdr) free (hdr); - STACK_UNWIND (frame, -1, ENOENT, NULL); + STACK_UNWIND (frame, -1, EINVAL, NULL); return 0; } @@ -1351,7 +1341,6 @@ 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); @@ -1361,7 +1350,6 @@ 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); @@ -1387,7 +1375,7 @@ client_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc) unwind: if (hdr) free (hdr); - STACK_UNWIND (frame, -1, ENOENT, oldloc->inode, NULL); + STACK_UNWIND (frame, -1, EINVAL, oldloc->inode, NULL); return 0; } @@ -1420,7 +1408,6 @@ 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); @@ -1443,7 +1430,7 @@ client_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset) unwind: if (hdr) free (hdr); - STACK_UNWIND (frame, -1, ENOENT, NULL); + STACK_UNWIND (frame, -1, EINVAL, NULL); return 0; } @@ -1484,7 +1471,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, EBADFD, NULL, 0, NULL); + STACK_UNWIND (frame, -1, EINVAL, NULL, 0, NULL); return 0; } @@ -1824,7 +1811,6 @@ 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); @@ -1853,7 +1839,7 @@ unwind: if (hdr) free (hdr); - STACK_UNWIND (frame, -1, ENOENT, NULL); + STACK_UNWIND (frame, -1, EINVAL, NULL); return 0; } @@ -1982,7 +1968,6 @@ 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); @@ -2015,7 +2000,7 @@ unwind: if (hdr) free (hdr); - STACK_UNWIND (frame, -1, ENOENT); + STACK_UNWIND (frame, -1, EINVAL); return 0; } @@ -2142,7 +2127,6 @@ 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); @@ -2167,7 +2151,7 @@ unwind: if (hdr) free (hdr); - STACK_UNWIND (frame, -1, ENOENT, NULL); + STACK_UNWIND (frame, -1, EINVAL, NULL); return 0; } @@ -2283,7 +2267,6 @@ 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); @@ -2305,7 +2288,7 @@ client_removexattr (call_frame_t *frame, xlator_t *this, loc_t *loc, unwind: if (hdr) free (hdr); - STACK_UNWIND (frame, -1, ENOENT); + STACK_UNWIND (frame, -1, EINVAL); return 0; } @@ -2345,7 +2328,6 @@ 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); @@ -2369,7 +2351,7 @@ client_opendir (call_frame_t *frame, xlator_t *this, loc_t *loc, unwind: if (hdr) free (hdr); - STACK_UNWIND (frame, -1, ENOENT, fd); + STACK_UNWIND (frame, -1, EINVAL, fd); return 0; } @@ -2667,7 +2649,6 @@ 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); @@ -2693,7 +2674,7 @@ unwind: if (hdr) free (hdr); - STACK_UNWIND (frame, -1, ENOENT); + STACK_UNWIND (frame, -1, EINVAL); return 0; } @@ -2965,7 +2946,6 @@ 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) @@ -3158,7 +3138,6 @@ 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); @@ -3189,7 +3168,7 @@ unwind: if (hdr) free (hdr); - STACK_UNWIND (frame, -1, ENOENT); + STACK_UNWIND (frame, -1, EINVAL); return 0; } @@ -3316,8 +3295,6 @@ 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); - op_errno = ENOENT; - goto unwind; } GF_VALIDATE_OR_GOTO (this->name, loc->name, unwind); baselen = STRLEN_0 (loc->name); @@ -3543,7 +3520,6 @@ 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); @@ -3566,7 +3542,7 @@ client_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, return ret; unwind: - STACK_UNWIND (frame, -1, ENOENT, NULL); + STACK_UNWIND (frame, -1, EINVAL, NULL); return 0; } @@ -5687,7 +5663,6 @@ 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); - goto unwind; } req->ino = hton64 (ino); @@ -5701,9 +5676,6 @@ client_checksum (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flag) hdr, hdrlen, NULL, 0, NULL); return ret; -unwind: - STACK_UNWIND (frame, -1, ENOENT, NULL, NULL); - return 0; } -- cgit