diff options
Diffstat (limited to 'xlators/protocol')
| -rw-r--r-- | xlators/protocol/client/src/client-handshake.c | 2 | ||||
| -rw-r--r-- | xlators/protocol/client/src/client-helpers.c | 17 | ||||
| -rw-r--r-- | xlators/protocol/client/src/client-rpc-fops.c | 2 | ||||
| -rw-r--r-- | xlators/protocol/client/src/client.c | 11 | ||||
| -rw-r--r-- | xlators/protocol/client/src/client.h | 4 | 
5 files changed, 30 insertions, 6 deletions
diff --git a/xlators/protocol/client/src/client-handshake.c b/xlators/protocol/client/src/client-handshake.c index 531b38eaf83..90192ad2ac8 100644 --- a/xlators/protocol/client/src/client-handshake.c +++ b/xlators/protocol/client/src/client-handshake.c @@ -1194,6 +1194,8 @@ client_setvolume_cbk (struct rpc_req *req, struct iovec *iov, int count, void *m          }          */ +        conf->client_id = glusterfs_leaf_position(this); +          gf_log (this->name, GF_LOG_INFO,                  "Connected to %s, attached to remote volume '%s'.",                  conf->rpc->conn.name, diff --git a/xlators/protocol/client/src/client-helpers.c b/xlators/protocol/client/src/client-helpers.c index 5d9f00fdc70..be5e7b57739 100644 --- a/xlators/protocol/client/src/client-helpers.c +++ b/xlators/protocol/client/src/client-helpers.c @@ -141,12 +141,16 @@ client_local_wipe (clnt_local_t *local)  }  int -unserialize_rsp_dirent (struct gfs3_readdir_rsp *rsp, gf_dirent_t *entries) +unserialize_rsp_dirent (xlator_t *this, struct gfs3_readdir_rsp *rsp, +                        gf_dirent_t *entries)  {          struct gfs3_dirlist  *trav      = NULL;  	gf_dirent_t          *entry     = NULL;          int                   entry_len = 0;          int                   ret       = -1; +        clnt_conf_t          *conf = NULL; + +        conf = this->private;          trav = rsp->reply;          while (trav) { @@ -156,7 +160,8 @@ unserialize_rsp_dirent (struct gfs3_readdir_rsp *rsp, gf_dirent_t *entries)                          goto out;                  entry->d_ino  = trav->d_ino; -                entry->d_off  = trav->d_off; +                gf_itransform (this, trav->d_off, &entry->d_off, +                                      conf->client_id);                  entry->d_len  = trav->d_len;                  entry->d_type = trav->d_type; @@ -182,12 +187,17 @@ unserialize_rsp_direntp (xlator_t *this, fd_t *fd,          inode_table_t        *itable    = NULL;          int                   entry_len = 0;          int                   ret       = -1; +        clnt_conf_t          *conf      = NULL;          trav = rsp->reply;          if (fd)                  itable = fd->inode->table; +        conf = this->private; +        if (!conf) +                goto out; +          while (trav) {                  entry_len = gf_dirent_size (trav->name);                  entry = GF_CALLOC (1, entry_len, gf_common_mt_gf_dirent_t); @@ -195,7 +205,8 @@ unserialize_rsp_direntp (xlator_t *this, fd_t *fd,                          goto out;                  entry->d_ino  = trav->d_ino; -                entry->d_off  = trav->d_off; +                gf_itransform (this, trav->d_off, &entry->d_off, +                                      conf->client_id);                  entry->d_len  = trav->d_len;                  entry->d_type = trav->d_type; diff --git a/xlators/protocol/client/src/client-rpc-fops.c b/xlators/protocol/client/src/client-rpc-fops.c index 7ca91e9880c..10abe845c0c 100644 --- a/xlators/protocol/client/src/client-rpc-fops.c +++ b/xlators/protocol/client/src/client-rpc-fops.c @@ -2450,7 +2450,7 @@ client3_3_readdir_cbk (struct rpc_req *req, struct iovec *iov, int count,          INIT_LIST_HEAD (&entries.list);          if (rsp.op_ret > 0) { -                unserialize_rsp_dirent (&rsp, &entries); +                unserialize_rsp_dirent (this, &rsp, &entries);          }          GF_PROTOCOL_DICT_UNSERIALIZE (frame->this, xdata, diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c index d9e7ccd0c4f..7fca01c5b6a 100644 --- a/xlators/protocol/client/src/client.c +++ b/xlators/protocol/client/src/client.c @@ -24,6 +24,7 @@  #include "xdr-rpc.h"  #include "glusterfs3.h" +#include "gf-dirent.h"  extern rpc_clnt_prog_t clnt_handshake_prog;  extern rpc_clnt_prog_t clnt_dump_prog; @@ -1913,6 +1914,9 @@ client_readdir (call_frame_t *frame, xlator_t *this, fd_t *fd,          if (!conf || !conf->fops)                  goto out; +        if (off != 0) +                off = gf_dirent_orig_offset(this, off); +          args.fd = fd;          args.size = size;          args.offset = off; @@ -1948,6 +1952,9 @@ client_readdirp (call_frame_t *frame, xlator_t *this, fd_t *fd,          if (!conf || !conf->fops)                  goto out; +        if (off != 0) +                off = gf_dirent_orig_offset(this, off); +          args.fd = fd;          args.size = size;          args.offset = off; @@ -2447,7 +2454,7 @@ build_client_config (xlator_t *this, clnt_conf_t *conf)  {          int                     ret = -1; -        if (!conf) +       if (!conf)                  goto out;          GF_OPTION_INIT ("frame-timeout", conf->rpc_conf.rpc_timeout, @@ -2470,6 +2477,8 @@ build_client_config (xlator_t *this, clnt_conf_t *conf)          GF_OPTION_INIT ("send-gids", conf->send_gids, bool, out); +        conf->client_id = glusterfs_leaf_position(this); +          ret = client_check_remote_host (this, this->options);          if (ret)                  goto out; diff --git a/xlators/protocol/client/src/client.h b/xlators/protocol/client/src/client.h index 7157e120dda..40200b6afc4 100644 --- a/xlators/protocol/client/src/client.h +++ b/xlators/protocol/client/src/client.h @@ -85,6 +85,7 @@ typedef struct clnt_conf {          rpc_clnt_prog_t       *handshake;          rpc_clnt_prog_t       *dump; +        int                    client_id;          uint64_t               reopen_fd_count; /* Count of fds reopened after a                                                     connection is established */          gf_lock_t              rec_lock; @@ -228,7 +229,8 @@ int client_submit_request (xlator_t *this, void *req,                             struct iovec *rsp_payload, int rsp_count,                             struct iobref *rsp_iobref, xdrproc_t xdrproc); -int unserialize_rsp_dirent (struct gfs3_readdir_rsp *rsp, gf_dirent_t *entries); +int unserialize_rsp_dirent (xlator_t *this, struct gfs3_readdir_rsp *rsp, +                            gf_dirent_t *entries);  int unserialize_rsp_direntp (xlator_t *this, fd_t *fd,                               struct gfs3_readdirp_rsp *rsp, gf_dirent_t *entries);  | 
