summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorshishir gowda <shishirng@gluster.com>2010-07-15 03:24:15 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-07-15 03:19:01 -0700
commit539a217dba16fcf3399a1ff29efe73e07fe5a0d7 (patch)
treeb37e5a20aff915b48d0926dfa76324158c912de9 /xlators
parent432bcc798907c0e9870c1d600b14571d02fca3c2 (diff)
return ENOENT instead of EINVAL in client-protocol
To fix ls command from returning a EINVAL error for a symlink and links over a striped distributed volume. Changing client_stat, client_lookup, client_link, client_setattr to return a ENOENT when the remote inode cannot be found on the striped non FIRST childs. Committer: shishir <shishirng@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 1006 ([3.0.5rc3 stripe] ls on link files gives EINVAL) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1006
Diffstat (limited to 'xlators')
-rw-r--r--xlators/protocol/client/src/client-protocol.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/xlators/protocol/client/src/client-protocol.c b/xlators/protocol/client/src/client-protocol.c
index d3ddc01f5..485eaa122 100644
--- a/xlators/protocol/client/src/client-protocol.c
+++ b/xlators/protocol/client/src/client-protocol.c
@@ -833,6 +833,7 @@ client_stat (call_frame_t *frame, xlator_t *this, loc_t *loc)
size_t pathlen = 0;
ino_t ino = 0;
ino_t gen = 0;
+ int32_t op_errno = EINVAL;
pathlen = STRLEN_0 (loc->path);
@@ -842,6 +843,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);
+ op_errno = ENOENT;
goto unwind;
}
@@ -864,7 +866,7 @@ client_stat (call_frame_t *frame, xlator_t *this, loc_t *loc)
unwind:
if (hdr)
free (hdr);
- STACK_UNWIND (frame, -1, EINVAL, NULL);
+ STACK_UNWIND (frame, -1, op_errno, NULL);
return 0;
}
@@ -1362,6 +1364,7 @@ client_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc)
ino_t newpar = 0;
uint64_t newgen = 0;
client_local_t *local = NULL;
+ int32_t op_errno = EINVAL;
local = calloc (1, sizeof (*local));
GF_VALIDATE_OR_GOTO (this->name, local, unwind);
@@ -1381,6 +1384,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);
+ op_errno = ENOENT;
goto unwind;
}
@@ -1417,7 +1421,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, EINVAL, oldloc->inode, NULL);
+ STACK_UNWIND (frame, -1, op_errno, oldloc->inode, NULL);
return 0;
}
@@ -3347,6 +3351,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);
+ op_errno = ENOENT;
goto unwind;
}
GF_VALIDATE_OR_GOTO (this->name, loc->name, unwind);
@@ -3561,6 +3566,7 @@ client_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
ino_t ino = 0;
uint64_t gen = 0;
int ret = -1;
+ int32_t op_errno = EINVAL;
GF_VALIDATE_OR_GOTO ("client", this, unwind);
GF_VALIDATE_OR_GOTO (this->name, frame, unwind);
@@ -3573,6 +3579,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);
+ op_errno = ENOENT;
goto unwind;
}
@@ -3596,7 +3603,7 @@ client_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
return ret;
unwind:
- STACK_UNWIND (frame, -1, EINVAL, NULL);
+ STACK_UNWIND (frame, -1, op_errno, NULL);
return 0;
}