diff options
author | Raghavendra Bhat <raghavendrabhat@gluster.com> | 2012-01-24 15:53:52 +0530 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2012-01-25 08:08:38 -0800 |
commit | fd61cd598b70fbc9442350483a3777d77990d257 (patch) | |
tree | a69c72b07f3bcee03b55be42b479019dc64616c2 /xlators/protocol/client/src/client.h | |
parent | e98752525706fd6d9989367eb84f1a7fc1b81fa4 (diff) |
protocol/client: if the remote_fd is -1, then unwind instead of sending the call to server
For calls with remote_fd set to -1, client xlator is sending the call to the
server which results in server not resolving it and thus fd being NULL. Locks
xlator when tries to get the inode context using the fd it segfaults. To avoid
it unwind the call in the client xlator if the remote_fd is -1.
Change-Id: Ic34a49fdf1012dd371f4b194703c0be74f29bda2
BUG: 784187
Signed-off-by: Raghavendra Bhat <raghavendrabhat@gluster.com>
Reviewed-on: http://review.gluster.com/2684
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Krishnan Parthasarathi <kp@gluster.com>
Reviewed-by: Anand Avati <avati@gluster.com>
Diffstat (limited to 'xlators/protocol/client/src/client.h')
-rw-r--r-- | xlators/protocol/client/src/client.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/xlators/protocol/client/src/client.h b/xlators/protocol/client/src/client.h index 00b743a3c70..2dda451c9cb 100644 --- a/xlators/protocol/client/src/client.h +++ b/xlators/protocol/client/src/client.h @@ -35,7 +35,7 @@ #define CLIENT_CMD_DISCONNECT "trusted.glusterfs.client-disconnect" #define CLIENT_DUMP_LOCKS "trusted.glusterfs.clientlk-dump" -#define CLIENT_GET_REMOTE_FD(conf, fd, remote_fd, label) \ +#define CLIENT_GET_REMOTE_FD(conf, fd, remote_fd, op_errno, label) \ do { \ clnt_fd_ctx_t *fdctx = NULL; \ pthread_mutex_lock (&conf->lock); \ @@ -48,6 +48,13 @@ } else { \ remote_fd = fdctx->remote_fd; \ } \ + if (remote_fd == -1) { \ + gf_log (THIS->name, GF_LOG_WARNING, " (%s) " \ + "remote_fd is -1. EBADFD", \ + uuid_utoa (fd->inode->gfid)); \ + op_errno = EBADFD; \ + goto label; \ + } \ } while (0); struct clnt_options { |