From 98a1f381ba15dfc9c19ea3f9d778e8efb9e6be8e Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Mon, 8 Nov 2010 03:43:20 +0000 Subject: quiesce: bring in feature to re-transmit the frames there was a corner case of 'fops' failing if they were in transit during a disconnection, if the failure is due to 'ENOTCONN' re-transmit the frame. Signed-off-by: Amar Tumballi Signed-off-by: Anand V. Avati BUG: 1500 (Mount point should not be in-accessible between reconnect to server) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1500 --- xlators/features/quiesce/src/quiesce.c | 1957 +++++++++++++++++++++++++------- xlators/features/quiesce/src/quiesce.h | 23 + 2 files changed, 1556 insertions(+), 424 deletions(-) (limited to 'xlators/features/quiesce') diff --git a/xlators/features/quiesce/src/quiesce.c b/xlators/features/quiesce/src/quiesce.c index cb52d0ee5..c9828054c 100644 --- a/xlators/features/quiesce/src/quiesce.c +++ b/xlators/features/quiesce/src/quiesce.c @@ -26,116 +26,1127 @@ #include "defaults.h" #include "call-stub.h" +/* TODO: */ +/* Think about 'writev/_*_lk/setattr/xattrop/' fops to do re-transmittion */ + + /* Quiesce Specific Functions */ +void +gf_quiesce_local_wipe (xlator_t *this, quiesce_local_t *local) +{ + quiesce_priv_t *priv = NULL; + + if (!local || !this || !this->private) + return; + + priv = this->private; + + if (local->loc.inode) + loc_wipe (&local->loc); + if (local->fd) + fd_unref (local->fd); + if (local->name) + GF_FREE (local->name); + if (local->volname) + GF_FREE (local->volname); + if (local->dict) + dict_unref (local->dict); + if (local->iobref) + iobref_unref (local->iobref); + if (local->vector) + GF_FREE (local->vector); + + mem_put (priv->local_pool, local); +} + call_stub_t * -gf_quiesce_dequeue (quiesce_priv_t *priv) +gf_quiesce_dequeue (xlator_t *this) +{ + call_stub_t *stub = NULL; + quiesce_priv_t *priv = NULL; + + priv = this->private; + + if (!priv || list_empty (&priv->req)) + return NULL; + + LOCK (&priv->lock); + { + stub = list_entry (priv->req.next, call_stub_t, list); + list_del_init (&stub->list); + priv->queue_size--; + } + UNLOCK (&priv->lock); + + return stub; +} + +void * +gf_quiesce_dequeue_start (void *data) +{ + xlator_t *this = NULL; + quiesce_priv_t *priv = NULL; + call_stub_t *stub = NULL; + + this = data; + priv = this->private; + THIS = this; + + while (!list_empty (&priv->req)) { + stub = gf_quiesce_dequeue (this); + if (stub) { + call_resume (stub); + } + } + + return 0; +} + + +void +gf_quiesce_timeout (void *data) +{ + xlator_t *this = NULL; + quiesce_priv_t *priv = NULL; + int need_dequeue = 0; + + this = data; + priv = this->private; + THIS = this; + + LOCK (&priv->lock); + { + priv->pass_through = _gf_true; + need_dequeue = (priv->queue_size)? 1:0; + } + UNLOCK (&priv->lock); + + gf_quiesce_dequeue_start (this); + + return; +} + +void +gf_quiesce_enqueue (xlator_t *this, call_stub_t *stub) +{ + quiesce_priv_t *priv = NULL; + struct timeval timeout = {0,}; + + priv = this->private; + if (!priv) { + gf_log_callingfn (this->name, GF_LOG_ERROR, + "this->private == NULL"); + return; + } + + LOCK (&priv->lock); + { + list_add_tail (&stub->list, &priv->req); + priv->queue_size++; + } + UNLOCK (&priv->lock); + + if (!priv->timer) { + timeout.tv_sec = 20; + timeout.tv_usec = 0; + + priv->timer = gf_timer_call_after (this->ctx, + timeout, + gf_quiesce_timeout, + (void *) this); + } + + return; +} + + + +/* _CBK function section */ + +int32_t +quiesce_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, inode_t *inode, + struct iatt *buf, dict_t *dict, struct iatt *postparent) +{ + quiesce_priv_t *priv = NULL; + call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; + + priv = this->private; + + local = frame->local; + frame->local = NULL; + if ((op_ret == -1) && (op_errno == ENOTCONN)) { + /* Re-transmit (by putting in the queue) */ + stub = fop_lookup_stub (frame, default_lookup_resume, + &local->loc, local->dict); + if (!stub) { + STACK_UNWIND_STRICT (lookup, frame, -1, ENOMEM, + NULL, NULL, NULL, NULL); + goto out; + } + + gf_quiesce_enqueue (this, stub); + goto out; + } + + STACK_UNWIND_STRICT (lookup, frame, op_ret, op_errno, inode, buf, + dict, postparent); +out: + gf_quiesce_local_wipe (this, local); + + return 0; +} + +int32_t +quiesce_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct iatt *buf) +{ + quiesce_priv_t *priv = NULL; + call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; + + priv = this->private; + + local = frame->local; + frame->local = NULL; + if ((op_ret == -1) && (op_errno == ENOTCONN)) { + /* Re-transmit (by putting in the queue) */ + stub = fop_stat_stub (frame, default_stat_resume, + &local->loc); + if (!stub) { + STACK_UNWIND_STRICT (stat, frame, -1, ENOMEM, + NULL); + goto out; + } + + gf_quiesce_enqueue (this, stub); + goto out; + } + + STACK_UNWIND_STRICT (stat, frame, op_ret, op_errno, buf); +out: + gf_quiesce_local_wipe (this, local); + + return 0; +} + +int32_t +quiesce_access_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno) +{ + quiesce_priv_t *priv = NULL; + call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; + + priv = this->private; + + local = frame->local; + frame->local = NULL; + if ((op_ret == -1) && (op_errno == ENOTCONN)) { + /* Re-transmit (by putting in the queue) */ + stub = fop_access_stub (frame, default_access_resume, + &local->loc, local->flag); + if (!stub) { + STACK_UNWIND_STRICT (access, frame, -1, ENOMEM); + goto out; + } + + gf_quiesce_enqueue (this, stub); + goto out; + } + + STACK_UNWIND_STRICT (access, frame, op_ret, op_errno); +out: + gf_quiesce_local_wipe (this, local); + + return 0; +} + +int32_t +quiesce_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, const char *path, + struct iatt *buf) +{ + quiesce_priv_t *priv = NULL; + call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; + + priv = this->private; + + local = frame->local; + frame->local = NULL; + if ((op_ret == -1) && (op_errno == ENOTCONN)) { + /* Re-transmit (by putting in the queue) */ + stub = fop_readlink_stub (frame, default_readlink_resume, + &local->loc, local->size); + if (!stub) { + STACK_UNWIND_STRICT (readlink, frame, -1, ENOMEM, + NULL, NULL); + goto out; + } + + gf_quiesce_enqueue (this, stub); + goto out; + } + + STACK_UNWIND_STRICT (readlink, frame, op_ret, op_errno, path, buf); +out: + gf_quiesce_local_wipe (this, local); + + return 0; +} + +int32_t +quiesce_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, fd_t *fd) +{ + quiesce_priv_t *priv = NULL; + call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; + + priv = this->private; + + local = frame->local; + frame->local = NULL; + if ((op_ret == -1) && (op_errno == ENOTCONN)) { + /* Re-transmit (by putting in the queue) */ + stub = fop_open_stub (frame, default_open_resume, + &local->loc, local->flag, local->fd, + local->wbflags); + if (!stub) { + STACK_UNWIND_STRICT (open, frame, -1, ENOMEM, + NULL); + goto out; + } + + gf_quiesce_enqueue (this, stub); + goto out; + } + + STACK_UNWIND_STRICT (open, frame, op_ret, op_errno, fd); +out: + gf_quiesce_local_wipe (this, local); + + return 0; +} + +int32_t +quiesce_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct iovec *vector, + int32_t count, struct iatt *stbuf, struct iobref *iobref) +{ + quiesce_priv_t *priv = NULL; + call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; + + priv = this->private; + + local = frame->local; + frame->local = NULL; + if ((op_ret == -1) && (op_errno == ENOTCONN)) { + /* Re-transmit (by putting in the queue) */ + stub = fop_readv_stub (frame, default_readv_resume, + local->fd, local->size, local->offset); + if (!stub) { + STACK_UNWIND_STRICT (readv, frame, -1, ENOMEM, + NULL, 0, NULL, NULL); + goto out; + } + + gf_quiesce_enqueue (this, stub); + goto out; + } + + STACK_UNWIND_STRICT (readv, frame, op_ret, op_errno, vector, count, + stbuf, iobref); +out: + gf_quiesce_local_wipe (this, local); + + return 0; +} + +int32_t +quiesce_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno) +{ + quiesce_priv_t *priv = NULL; + call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; + + priv = this->private; + + local = frame->local; + frame->local = NULL; + if ((op_ret == -1) && (op_errno == ENOTCONN)) { + /* Re-transmit (by putting in the queue) */ + stub = fop_flush_stub (frame, default_flush_resume, + local->fd); + if (!stub) { + STACK_UNWIND_STRICT (flush, frame, -1, ENOMEM); + goto out; + } + + gf_quiesce_enqueue (this, stub); + goto out; + } + + STACK_UNWIND_STRICT (flush, frame, op_ret, op_errno); +out: + gf_quiesce_local_wipe (this, local); + + return 0; +} + + + +int32_t +quiesce_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct iatt *prebuf, + struct iatt *postbuf) +{ + quiesce_priv_t *priv = NULL; + call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; + + priv = this->private; + + local = frame->local; + frame->local = NULL; + if ((op_ret == -1) && (op_errno == ENOTCONN)) { + /* Re-transmit (by putting in the queue) */ + stub = fop_fsync_stub (frame, default_fsync_resume, + local->fd, local->flag); + if (!stub) { + STACK_UNWIND_STRICT (fsync, frame, -1, ENOMEM, + NULL, NULL); + goto out; + } + + gf_quiesce_enqueue (this, stub); + goto out; + } + + STACK_UNWIND_STRICT (fsync, frame, op_ret, op_errno, prebuf, postbuf); +out: + gf_quiesce_local_wipe (this, local); + + return 0; +} + +int32_t +quiesce_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct iatt *buf) +{ + quiesce_priv_t *priv = NULL; + call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; + + priv = this->private; + + local = frame->local; + frame->local = NULL; + if ((op_ret == -1) && (op_errno == ENOTCONN)) { + /* Re-transmit (by putting in the queue) */ + stub = fop_fstat_stub (frame, default_fstat_resume, + local->fd); + if (!stub) { + STACK_UNWIND_STRICT (fstat, frame, -1, ENOMEM, + NULL); + goto out; + } + + gf_quiesce_enqueue (this, stub); + goto out; + } + + STACK_UNWIND_STRICT (fstat, frame, op_ret, op_errno, buf); +out: + gf_quiesce_local_wipe (this, local); + + return 0; +} + +int32_t +quiesce_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, fd_t *fd) +{ + quiesce_priv_t *priv = NULL; + call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; + + priv = this->private; + + local = frame->local; + frame->local = NULL; + if ((op_ret == -1) && (op_errno == ENOTCONN)) { + /* Re-transmit (by putting in the queue) */ + stub = fop_opendir_stub (frame, default_opendir_resume, + &local->loc, local->fd); + if (!stub) { + STACK_UNWIND_STRICT (opendir, frame, -1, ENOMEM, + NULL); + goto out; + } + + gf_quiesce_enqueue (this, stub); + goto out; + } + + STACK_UNWIND_STRICT (opendir, frame, op_ret, op_errno, fd); +out: + gf_quiesce_local_wipe (this, local); + + return 0; +} + +int32_t +quiesce_fsyncdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno) +{ + quiesce_priv_t *priv = NULL; + call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; + + priv = this->private; + + local = frame->local; + frame->local = NULL; + if ((op_ret == -1) && (op_errno == ENOTCONN)) { + /* Re-transmit (by putting in the queue) */ + stub = fop_fsyncdir_stub (frame, default_fsyncdir_resume, + local->fd, local->flag); + if (!stub) { + STACK_UNWIND_STRICT (fsyncdir, frame, -1, ENOMEM); + goto out; + } + + gf_quiesce_enqueue (this, stub); + goto out; + } + + STACK_UNWIND_STRICT (fsyncdir, frame, op_ret, op_errno); +out: + gf_quiesce_local_wipe (this, local); + + return 0; +} + +int32_t +quiesce_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct statvfs *buf) +{ + quiesce_priv_t *priv = NULL; + call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; + + priv = this->private; + + local = frame->local; + frame->local = NULL; + if ((op_ret == -1) && (op_errno == ENOTCONN)) { + /* Re-transmit (by putting in the queue) */ + stub = fop_statfs_stub (frame, default_statfs_resume, + &local->loc); + if (!stub) { + STACK_UNWIND_STRICT (statfs, frame, -1, ENOMEM, + NULL); + goto out; + } + + gf_quiesce_enqueue (this, stub); + goto out; + } + + STACK_UNWIND_STRICT (statfs, frame, op_ret, op_errno, buf); +out: + gf_quiesce_local_wipe (this, local); + + return 0; +} + +int32_t +quiesce_fgetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, dict_t *dict) +{ + quiesce_priv_t *priv = NULL; + call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; + + priv = this->private; + + local = frame->local; + frame->local = NULL; + if ((op_ret == -1) && (op_errno == ENOTCONN)) { + /* Re-transmit (by putting in the queue) */ + stub = fop_fgetxattr_stub (frame, default_fgetxattr_resume, + local->fd, local->name); + if (!stub) { + STACK_UNWIND_STRICT (fgetxattr, frame, -1, ENOMEM, + NULL); + goto out; + } + + gf_quiesce_enqueue (this, stub); + goto out; + } + + STACK_UNWIND_STRICT (fgetxattr, frame, op_ret, op_errno, dict); +out: + gf_quiesce_local_wipe (this, local); + + return 0; +} + + +int32_t +quiesce_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, dict_t *dict) +{ + quiesce_priv_t *priv = NULL; + call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; + + priv = this->private; + + local = frame->local; + frame->local = NULL; + if ((op_ret == -1) && (op_errno == ENOTCONN)) { + /* Re-transmit (by putting in the queue) */ + stub = fop_getxattr_stub (frame, default_getxattr_resume, + &local->loc, local->name); + if (!stub) { + STACK_UNWIND_STRICT (getxattr, frame, -1, ENOMEM, + NULL); + goto out; + } + + gf_quiesce_enqueue (this, stub); + goto out; + } + + STACK_UNWIND_STRICT (getxattr, frame, op_ret, op_errno, dict); +out: + gf_quiesce_local_wipe (this, local); + + return 0; +} + + +int32_t +quiesce_rchecksum_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, uint32_t weak_checksum, + uint8_t *strong_checksum) +{ + quiesce_priv_t *priv = NULL; + call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; + + priv = this->private; + + local = frame->local; + frame->local = NULL; + if ((op_ret == -1) && (op_errno == ENOTCONN)) { + /* Re-transmit (by putting in the queue) */ + stub = fop_rchecksum_stub (frame, default_rchecksum_resume, + local->fd, local->offset, local->flag); + if (!stub) { + STACK_UNWIND_STRICT (rchecksum, frame, -1, ENOMEM, + 0, NULL); + goto out; + } + + gf_quiesce_enqueue (this, stub); + goto out; + } + + STACK_UNWIND_STRICT (rchecksum, frame, op_ret, op_errno, weak_checksum, + strong_checksum); +out: + gf_quiesce_local_wipe (this, local); + + return 0; +} + + +int32_t +quiesce_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, gf_dirent_t *entries) +{ + quiesce_priv_t *priv = NULL; + call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; + + priv = this->private; + + local = frame->local; + frame->local = NULL; + if ((op_ret == -1) && (op_errno == ENOTCONN)) { + /* Re-transmit (by putting in the queue) */ + stub = fop_readdir_stub (frame, default_readdir_resume, + local->fd, local->size, local->offset); + if (!stub) { + STACK_UNWIND_STRICT (readdir, frame, -1, ENOMEM, + NULL); + goto out; + } + + gf_quiesce_enqueue (this, stub); + goto out; + } + + STACK_UNWIND_STRICT (readdir, frame, op_ret, op_errno, entries); +out: + gf_quiesce_local_wipe (this, local); + + return 0; +} + + +int32_t +quiesce_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, gf_dirent_t *entries) +{ + quiesce_priv_t *priv = NULL; + call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; + + priv = this->private; + + local = frame->local; + frame->local = NULL; + if ((op_ret == -1) && (op_errno == ENOTCONN)) { + /* Re-transmit (by putting in the queue) */ + stub = fop_readdirp_stub (frame, default_readdirp_resume, + local->fd, local->size, local->offset); + if (!stub) { + STACK_UNWIND_STRICT (readdirp, frame, -1, ENOMEM, + NULL); + goto out; + } + + gf_quiesce_enqueue (this, stub); + goto out; + } + + STACK_UNWIND_STRICT (readdirp, frame, op_ret, op_errno, entries); +out: + gf_quiesce_local_wipe (this, local); + + return 0; +} + + +#if 0 + +int32_t +quiesce_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct iatt *prebuf, + struct iatt *postbuf) +{ + quiesce_priv_t *priv = NULL; + call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; + + priv = this->private; + + local = frame->local; + frame->local = NULL; + if ((op_ret == -1) && (op_errno == ENOTCONN)) { + /* Re-transmit (by putting in the queue) */ + stub = fop_writev_stub (frame, default_writev_resume, + local->fd, local->vector, local->flag, + local->offset, local->iobref); + if (!stub) { + STACK_UNWIND_STRICT (writev, frame, -1, ENOMEM, + NULL, NULL); + goto out; + } + + gf_quiesce_enqueue (this, stub); + goto out; + } + + STACK_UNWIND_STRICT (writev, frame, op_ret, op_errno, prebuf, postbuf); +out: + gf_quiesce_local_wipe (this, local); + + return 0; +} + +int32_t +quiesce_xattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, dict_t *dict) +{ + quiesce_priv_t *priv = NULL; + call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; + + priv = this->private; + + local = frame->local; + frame->local = NULL; + if ((op_ret == -1) && (op_errno == ENOTCONN)) { + /* Re-transmit (by putting in the queue) */ + stub = fop_xattrop_stub (frame, default_xattrop_resume, + &local->loc, local->xattrop_flags, + local->dict); + if (!stub) { + STACK_UNWIND_STRICT (xattrop, frame, -1, ENOMEM, + NULL); + goto out; + } + + gf_quiesce_enqueue (this, stub); + goto out; + } + + STACK_UNWIND_STRICT (xattrop, frame, op_ret, op_errno, dict); +out: + gf_quiesce_local_wipe (this, local); + + return 0; +} + +int32_t +quiesce_fxattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, dict_t *dict) { - call_stub_t *stub = NULL; + quiesce_priv_t *priv = NULL; + call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; - if (list_empty (&priv->req)) - return NULL; + priv = this->private; - LOCK (&priv->lock); - { - stub = list_entry (priv->req.next, call_stub_t, list); - list_del_init (&stub->list); - priv->queue_size--; + local = frame->local; + frame->local = NULL; + if ((op_ret == -1) && (op_errno == ENOTCONN)) { + /* Re-transmit (by putting in the queue) */ + stub = fop_fxattrop_stub (frame, default_fxattrop_resume, + local->fd, local->xattrop_flags, + local->dict); + if (!stub) { + STACK_UNWIND_STRICT (fxattrop, frame, -1, ENOMEM, + NULL); + goto out; + } + + gf_quiesce_enqueue (this, stub); + goto out; } - UNLOCK (&priv->lock); - return stub; + STACK_UNWIND_STRICT (fxattrop, frame, op_ret, op_errno, dict); +out: + gf_quiesce_local_wipe (this, local); + + return 0; } +int32_t +quiesce_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct gf_flock *lock) +{ + quiesce_priv_t *priv = NULL; + call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; + + priv = this->private; -void -gf_quiesce_enqueue (quiesce_priv_t *priv, call_stub_t *stub) + local = frame->local; + frame->local = NULL; + if ((op_ret == -1) && (op_errno == ENOTCONN)) { + /* Re-transmit (by putting in the queue) */ + stub = fop_lk_stub (frame, default_lk_resume, + local->fd, local->flag, &local->flock); + if (!stub) { + STACK_UNWIND_STRICT (lk, frame, -1, ENOMEM, + NULL); + goto out; + } + + gf_quiesce_enqueue (this, stub); + goto out; + } + + STACK_UNWIND_STRICT (lk, frame, op_ret, op_errno, lock); +out: + gf_quiesce_local_wipe (this, local); + + return 0; +} + +int32_t +quiesce_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno) { - LOCK (&priv->lock); - { - list_add_tail (&stub->list, &priv->req); - priv->queue_size++; + quiesce_priv_t *priv = NULL; + call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; + + priv = this->private; + + local = frame->local; + frame->local = NULL; + if ((op_ret == -1) && (op_errno == ENOTCONN)) { + /* Re-transmit (by putting in the queue) */ + stub = fop_inodelk_stub (frame, default_inodelk_resume, + local->volname, &local->loc, + local->flag, &local->flock); + if (!stub) { + STACK_UNWIND_STRICT (inodelk, frame, -1, ENOMEM); + goto out; + } + + gf_quiesce_enqueue (this, stub); + goto out; } - UNLOCK (&priv->lock); - return; + STACK_UNWIND_STRICT (inodelk, frame, op_ret, op_errno); +out: + gf_quiesce_local_wipe (this, local); + + return 0; } -void * -gf_quiesce_dequeue_start (void *data) +int32_t +quiesce_finodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno) { - xlator_t *this = NULL; quiesce_priv_t *priv = NULL; call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; - this = data; priv = this->private; - THIS = this; - while (!list_empty (&priv->req)) { - stub = gf_quiesce_dequeue (priv); - if (stub) { - call_resume (stub); + local = frame->local; + frame->local = NULL; + if ((op_ret == -1) && (op_errno == ENOTCONN)) { + /* Re-transmit (by putting in the queue) */ + stub = fop_finodelk_stub (frame, default_finodelk_resume, + local->volname, local->fd, + local->flag, &local->flock); + if (!stub) { + STACK_UNWIND_STRICT (finodelk, frame, -1, ENOMEM); + goto out; } + + gf_quiesce_enqueue (this, stub); + goto out; } + STACK_UNWIND_STRICT (finodelk, frame, op_ret, op_errno); +out: + gf_quiesce_local_wipe (this, local); + return 0; } +int32_t +quiesce_entrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno) +{ + quiesce_priv_t *priv = NULL; + call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; -void -gf_quiesce_timeout (void *data) + priv = this->private; + + local = frame->local; + frame->local = NULL; + if ((op_ret == -1) && (op_errno == ENOTCONN)) { + /* Re-transmit (by putting in the queue) */ + stub = fop_entrylk_stub (frame, default_entrylk_resume, + local->volname, &local->loc, + local->name, local->cmd, local->type); + if (!stub) { + STACK_UNWIND_STRICT (entrylk, frame, -1, ENOMEM); + goto out; + } + + gf_quiesce_enqueue (this, stub); + goto out; + } + + STACK_UNWIND_STRICT (entrylk, frame, op_ret, op_errno); +out: + gf_quiesce_local_wipe (this, local); + + return 0; +} + +int32_t +quiesce_fentrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno) { - xlator_t *this = NULL; quiesce_priv_t *priv = NULL; - int need_dequeue = 0; + call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; - this = data; priv = this->private; - THIS = this; - LOCK (&priv->lock); - { - priv->pass_through = _gf_true; - need_dequeue = (priv->queue_size)? 1:0; + local = frame->local; + frame->local = NULL; + if ((op_ret == -1) && (op_errno == ENOTCONN)) { + /* Re-transmit (by putting in the queue) */ + stub = fop_fentrylk_stub (frame, default_fentrylk_resume, + local->volname, local->fd, + local->name, local->cmd, local->type); + if (!stub) { + STACK_UNWIND_STRICT (fentrylk, frame, -1, ENOMEM); + goto out; + } + + gf_quiesce_enqueue (this, stub); + goto out; } - UNLOCK (&priv->lock); - gf_quiesce_dequeue_start (this); + STACK_UNWIND_STRICT (fentrylk, frame, op_ret, op_errno); +out: + gf_quiesce_local_wipe (this, local); - return; + return 0; } -/* FOP */ +int32_t +quiesce_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct iatt *statpre, + struct iatt *statpost) +{ + quiesce_priv_t *priv = NULL; + call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; + + priv = this->private; + + local = frame->local; + frame->local = NULL; + if ((op_ret == -1) && (op_errno == ENOTCONN)) { + /* Re-transmit (by putting in the queue) */ + stub = fop_setattr_stub (frame, default_setattr_resume, + &local->loc, &local->stbuf, local->flag); + if (!stub) { + STACK_UNWIND_STRICT (setattr, frame, -1, ENOMEM, + NULL, NULL); + goto out; + } + + gf_quiesce_enqueue (this, stub); + goto out; + } + + STACK_UNWIND_STRICT (setattr, frame, op_ret, op_errno, statpre, + statpost); +out: + gf_quiesce_local_wipe (this, local); + + return 0; +} int32_t -quiesce_fgetxattr (call_frame_t *frame, - xlator_t *this, - fd_t *fd, - const char *name) +quiesce_fsetattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct iatt *statpre, + struct iatt *statpost) { quiesce_priv_t *priv = NULL; call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; + + priv = this->private; + + local = frame->local; + frame->local = NULL; + + if ((op_ret == -1) && (op_errno == ENOTCONN)) { + /* Re-transmit (by putting in the queue) */ + stub = fop_fsetattr_stub (frame, default_fsetattr_resume, + local->fd, &local->stbuf, local->flag); + if (!stub) { + STACK_UNWIND_STRICT (fsetattr, frame, -1, ENOMEM, + NULL, NULL); + goto out; + } + + gf_quiesce_enqueue (this, stub); + goto out; + } + + STACK_UNWIND_STRICT (fsetattr, frame, op_ret, op_errno, statpre, + statpost); +out: + gf_quiesce_local_wipe (this, local); + + return 0; +} + +#endif /* if 0 */ + + +/* FOP */ + +/* No retransmittion */ + +int32_t +quiesce_removexattr (call_frame_t *frame, + xlator_t *this, + loc_t *loc, + const char *name) +{ + quiesce_priv_t *priv = NULL; + call_stub_t *stub = NULL; priv = this->private; if (priv->pass_through) { STACK_WIND (frame, - default_fgetxattr_cbk, + default_removexattr_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->fgetxattr, - fd, + FIRST_CHILD(this)->fops->removexattr, + loc, name); + return 0; + } + + stub = fop_removexattr_stub (frame, default_removexattr_resume, + loc, name); + if (!stub) { + STACK_UNWIND_STRICT (removexattr, frame, -1, ENOMEM); return 0; } - stub = fop_fgetxattr_stub (frame, default_fgetxattr_resume, fd, name); + gf_quiesce_enqueue (this, stub); + + return 0; +} + +int32_t +quiesce_truncate (call_frame_t *frame, + xlator_t *this, + loc_t *loc, + off_t offset) +{ + quiesce_priv_t *priv = NULL; + call_stub_t *stub = NULL; + + priv = this->private; + + if (priv->pass_through) { + STACK_WIND (frame, + default_truncate_cbk, + FIRST_CHILD(this), + FIRST_CHILD(this)->fops->truncate, + loc, + offset); + return 0; + } + + stub = fop_truncate_stub (frame, default_truncate_resume, loc, offset); if (!stub) { - STACK_UNWIND_STRICT (fgetxattr, frame, -1, ENOMEM, NULL); + STACK_UNWIND_STRICT (truncate, frame, -1, ENOMEM, NULL, NULL); return 0; } - gf_quiesce_enqueue (priv, stub); + gf_quiesce_enqueue (this, stub); return 0; } @@ -170,7 +1181,7 @@ quiesce_fsetxattr (call_frame_t *frame, return 0; } - gf_quiesce_enqueue (priv, stub); + gf_quiesce_enqueue (this, stub); return 0; } @@ -205,15 +1216,49 @@ quiesce_setxattr (call_frame_t *frame, return 0; } - gf_quiesce_enqueue (priv, stub); + gf_quiesce_enqueue (this, stub); return 0; } int32_t -quiesce_statfs (call_frame_t *frame, - xlator_t *this, - loc_t *loc) +quiesce_create (call_frame_t *frame, xlator_t *this, + loc_t *loc, int32_t flags, mode_t mode, + fd_t *fd, dict_t *params) +{ + quiesce_priv_t *priv = NULL; + call_stub_t *stub = NULL; + + priv = this->private; + + if (priv->pass_through) { + /* Don't send O_APPEND below, as write() re-transmittions can + fail with O_APPEND */ + STACK_WIND (frame, default_create_cbk, + FIRST_CHILD(this), + FIRST_CHILD(this)->fops->create, + loc, (flags & ~O_APPEND), mode, fd, params); + return 0; + } + + stub = fop_create_stub (frame, default_create_resume, + loc, (flags & ~O_APPEND), mode, fd, params); + if (!stub) { + STACK_UNWIND_STRICT (create, frame, -1, ENOMEM, + NULL, NULL, NULL, NULL, NULL); + return 0; + } + + gf_quiesce_enqueue (this, stub); + + return 0; +} + +int32_t +quiesce_link (call_frame_t *frame, + xlator_t *this, + loc_t *oldloc, + loc_t *newloc) { quiesce_priv_t *priv = NULL; call_stub_t *stub = NULL; @@ -222,29 +1267,30 @@ quiesce_statfs (call_frame_t *frame, if (priv->pass_through) { STACK_WIND (frame, - default_statfs_cbk, + default_link_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->statfs, - loc); + FIRST_CHILD(this)->fops->link, + oldloc, newloc); return 0; } - stub = fop_statfs_stub (frame, default_statfs_resume, loc); + stub = fop_link_stub (frame, default_link_resume, oldloc, newloc); if (!stub) { - STACK_UNWIND_STRICT (statfs, frame, -1, ENOMEM, NULL); + STACK_UNWIND_STRICT (link, frame, -1, ENOMEM, + NULL, NULL, NULL, NULL); return 0; } - gf_quiesce_enqueue (priv, stub); + gf_quiesce_enqueue (this, stub); return 0; } int32_t -quiesce_fsyncdir (call_frame_t *frame, - xlator_t *this, - fd_t *fd, - int32_t flags) +quiesce_rename (call_frame_t *frame, + xlator_t *this, + loc_t *oldloc, + loc_t *newloc) { quiesce_priv_t *priv = NULL; call_stub_t *stub = NULL; @@ -253,29 +1299,29 @@ quiesce_fsyncdir (call_frame_t *frame, if (priv->pass_through) { STACK_WIND (frame, - default_fsyncdir_cbk, + default_rename_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->fsyncdir, - fd, - flags); + FIRST_CHILD(this)->fops->rename, + oldloc, newloc); return 0; } - stub = fop_fsyncdir_stub (frame, default_fsyncdir_resume, fd, flags); + stub = fop_rename_stub (frame, default_rename_resume, oldloc, newloc); if (!stub) { - STACK_UNWIND_STRICT (fsyncdir, frame, -1, ENOMEM); + STACK_UNWIND_STRICT (rename, frame, -1, ENOMEM, + NULL, NULL, NULL, NULL, NULL); return 0; } - gf_quiesce_enqueue (priv, stub); + gf_quiesce_enqueue (this, stub); return 0; } -int32_t -quiesce_opendir (call_frame_t *frame, - xlator_t *this, - loc_t *loc, fd_t *fd) + +int +quiesce_symlink (call_frame_t *frame, xlator_t *this, + const char *linkpath, loc_t *loc, dict_t *params) { quiesce_priv_t *priv = NULL; call_stub_t *stub = NULL; @@ -283,29 +1329,29 @@ quiesce_opendir (call_frame_t *frame, priv = this->private; if (priv->pass_through) { - STACK_WIND (frame, - default_opendir_cbk, + STACK_WIND (frame, default_symlink_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->opendir, - loc, fd); + FIRST_CHILD(this)->fops->symlink, + linkpath, loc, params); return 0; } - stub = fop_opendir_stub (frame, default_opendir_resume, loc, fd); + stub = fop_symlink_stub (frame, default_symlink_resume, + linkpath, loc, params); if (!stub) { - STACK_UNWIND_STRICT (opendir, frame, -1, ENOMEM, NULL); + STACK_UNWIND_STRICT (symlink, frame, -1, ENOMEM, + NULL, NULL, NULL, NULL); return 0; } - gf_quiesce_enqueue (priv, stub); + gf_quiesce_enqueue (this, stub); return 0; } -int32_t -quiesce_fstat (call_frame_t *frame, - xlator_t *this, - fd_t *fd) + +int +quiesce_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags) { quiesce_priv_t *priv = NULL; call_stub_t *stub = NULL; @@ -313,30 +1359,28 @@ quiesce_fstat (call_frame_t *frame, priv = this->private; if (priv->pass_through) { - STACK_WIND (frame, - default_fstat_cbk, + STACK_WIND (frame, default_rmdir_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->fstat, - fd); + FIRST_CHILD(this)->fops->rmdir, + loc, flags); return 0; } - stub = fop_fstat_stub (frame, default_fstat_resume, fd); + stub = fop_rmdir_stub (frame, default_rmdir_resume, loc, flags); if (!stub) { - STACK_UNWIND_STRICT (fstat, frame, -1, ENOMEM, NULL); + STACK_UNWIND_STRICT (rmdir, frame, -1, ENOMEM, NULL, NULL); return 0; } - gf_quiesce_enqueue (priv, stub); + gf_quiesce_enqueue (this, stub); return 0; } int32_t -quiesce_fsync (call_frame_t *frame, - xlator_t *this, - fd_t *fd, - int32_t flags) +quiesce_unlink (call_frame_t *frame, + xlator_t *this, + loc_t *loc) { quiesce_priv_t *priv = NULL; call_stub_t *stub = NULL; @@ -345,29 +1389,27 @@ quiesce_fsync (call_frame_t *frame, if (priv->pass_through) { STACK_WIND (frame, - default_fsync_cbk, + default_unlink_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->fsync, - fd, - flags); + FIRST_CHILD(this)->fops->unlink, + loc); return 0; } - stub = fop_fsync_stub (frame, default_fsync_resume, fd, flags); + stub = fop_unlink_stub (frame, default_unlink_resume, loc); if (!stub) { - STACK_UNWIND_STRICT (fsync, frame, -1, ENOMEM, NULL, NULL); + STACK_UNWIND_STRICT (unlink, frame, -1, ENOMEM, NULL, NULL); return 0; } - gf_quiesce_enqueue (priv, stub); + gf_quiesce_enqueue (this, stub); return 0; } -int32_t -quiesce_flush (call_frame_t *frame, - xlator_t *this, - fd_t *fd) +int +quiesce_mkdir (call_frame_t *frame, xlator_t *this, + loc_t *loc, mode_t mode, dict_t *params) { quiesce_priv_t *priv = NULL; call_stub_t *stub = NULL; @@ -375,33 +1417,30 @@ quiesce_flush (call_frame_t *frame, priv = this->private; if (priv->pass_through) { - STACK_WIND (frame, - default_flush_cbk, + STACK_WIND (frame, default_mkdir_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->flush, - fd); + FIRST_CHILD(this)->fops->mkdir, + loc, mode, params); return 0; } - stub = fop_flush_stub (frame, default_flush_resume, fd); + stub = fop_mkdir_stub (frame, default_mkdir_resume, + loc, mode, params); if (!stub) { - STACK_UNWIND_STRICT (flush, frame, -1, ENOMEM); + STACK_UNWIND_STRICT (mkdir, frame, -1, ENOMEM, + NULL, NULL, NULL, NULL); return 0; } - gf_quiesce_enqueue (priv, stub); + gf_quiesce_enqueue (this, stub); return 0; } -int32_t -quiesce_writev (call_frame_t *frame, - xlator_t *this, - fd_t *fd, - struct iovec *vector, - int32_t count, - off_t off, - struct iobref *iobref) + +int +quiesce_mknod (call_frame_t *frame, xlator_t *this, + loc_t *loc, mode_t mode, dev_t rdev, dict_t *parms) { quiesce_priv_t *priv = NULL; call_stub_t *stub = NULL; @@ -409,36 +1448,31 @@ quiesce_writev (call_frame_t *frame, priv = this->private; if (priv->pass_through) { - STACK_WIND (frame, - default_writev_cbk, + STACK_WIND (frame, default_mknod_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->writev, - fd, - vector, - count, - off, - iobref); + FIRST_CHILD(this)->fops->mknod, + loc, mode, rdev, parms); return 0; } - stub = fop_writev_stub (frame, default_writev_resume, - fd, vector, count, off, iobref); + stub = fop_mknod_stub (frame, default_mknod_resume, + loc, mode, rdev, parms); if (!stub) { - STACK_UNWIND_STRICT (writev, frame, -1, ENOMEM, NULL, NULL); + STACK_UNWIND_STRICT (mknod, frame, -1, ENOMEM, + NULL, NULL, NULL, NULL); return 0; } - gf_quiesce_enqueue (priv, stub); + gf_quiesce_enqueue (this, stub); return 0; } int32_t -quiesce_readv (call_frame_t *frame, - xlator_t *this, - fd_t *fd, - size_t size, - off_t offset) +quiesce_ftruncate (call_frame_t *frame, + xlator_t *this, + fd_t *fd, + off_t offset) { quiesce_priv_t *priv = NULL; call_stub_t *stub = NULL; @@ -447,399 +1481,483 @@ quiesce_readv (call_frame_t *frame, if (priv->pass_through) { STACK_WIND (frame, - default_readv_cbk, + default_ftruncate_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->readv, + FIRST_CHILD(this)->fops->ftruncate, fd, - size, offset); return 0; } - stub = fop_readv_stub (frame, default_readv_resume, fd, size, offset); + stub = fop_ftruncate_stub (frame, default_ftruncate_resume, fd, offset); if (!stub) { - STACK_UNWIND_STRICT (readv, frame, -1, ENOMEM, - NULL, 0, NULL, NULL); + STACK_UNWIND_STRICT (ftruncate, frame, -1, ENOMEM, NULL, NULL); return 0; } - gf_quiesce_enqueue (priv, stub); + gf_quiesce_enqueue (this, stub); return 0; } +/* Re-transmittion */ int32_t -quiesce_open (call_frame_t *frame, - xlator_t *this, - loc_t *loc, - int32_t flags, fd_t *fd, - int32_t wbflags) +quiesce_readlink (call_frame_t *frame, + xlator_t *this, + loc_t *loc, + size_t size) { quiesce_priv_t *priv = NULL; call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; priv = this->private; - if (priv->pass_through) { + if (priv && priv->pass_through) { + local = mem_get0 (priv->local_pool); + loc_dup (loc, &local->loc); + local->size = size; + frame->local = local; + STACK_WIND (frame, - default_open_cbk, + quiesce_readlink_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->open, - loc, flags, fd, wbflags); + FIRST_CHILD(this)->fops->readlink, + loc, + size); return 0; } - stub = fop_open_stub (frame, default_open_resume, loc, - flags, fd, wbflags); + stub = fop_readlink_stub (frame, default_readlink_resume, loc, size); if (!stub) { - STACK_UNWIND_STRICT (open, frame, -1, ENOMEM, NULL); + STACK_UNWIND_STRICT (readlink, frame, -1, ENOMEM, NULL, NULL); return 0; } - gf_quiesce_enqueue (priv, stub); + gf_quiesce_enqueue (this, stub); return 0; } + int32_t -quiesce_create (call_frame_t *frame, xlator_t *this, - loc_t *loc, int32_t flags, mode_t mode, - fd_t *fd, dict_t *params) +quiesce_access (call_frame_t *frame, + xlator_t *this, + loc_t *loc, + int32_t mask) { quiesce_priv_t *priv = NULL; call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; priv = this->private; - if (priv->pass_through) { - STACK_WIND (frame, default_create_cbk, + if (priv && priv->pass_through) { + local = mem_get0 (priv->local_pool); + loc_dup (loc, &local->loc); + local->flag = mask; + frame->local = local; + + STACK_WIND (frame, + quiesce_access_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->create, - loc, flags, mode, fd, params); + FIRST_CHILD(this)->fops->access, + loc, + mask); return 0; } - stub = fop_create_stub (frame, default_create_resume, - loc, flags, mode, fd, params); + stub = fop_access_stub (frame, default_access_resume, loc, mask); if (!stub) { - STACK_UNWIND_STRICT (create, frame, -1, ENOMEM, - NULL, NULL, NULL, NULL, NULL); + STACK_UNWIND_STRICT (access, frame, -1, ENOMEM); return 0; } - gf_quiesce_enqueue (priv, stub); + gf_quiesce_enqueue (this, stub); return 0; } int32_t -quiesce_link (call_frame_t *frame, - xlator_t *this, - loc_t *oldloc, - loc_t *newloc) +quiesce_fgetxattr (call_frame_t *frame, + xlator_t *this, + fd_t *fd, + const char *name) { - quiesce_priv_t *priv = NULL; + quiesce_priv_t *priv = NULL; call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; priv = this->private; - if (priv->pass_through) { + if (priv && priv->pass_through) { + local = mem_get0 (priv->local_pool); + local->fd = fd_ref (fd); + if (name) + local->name = gf_strdup (name); + + frame->local = local; + STACK_WIND (frame, - default_link_cbk, + quiesce_fgetxattr_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->link, - oldloc, newloc); - return 0; + FIRST_CHILD(this)->fops->fgetxattr, + fd, + name); + return 0; } - stub = fop_link_stub (frame, default_link_resume, oldloc, newloc); + stub = fop_fgetxattr_stub (frame, default_fgetxattr_resume, fd, name); if (!stub) { - STACK_UNWIND_STRICT (link, frame, -1, ENOMEM, - NULL, NULL, NULL, NULL); + STACK_UNWIND_STRICT (fgetxattr, frame, -1, ENOMEM, NULL); return 0; } - gf_quiesce_enqueue (priv, stub); + gf_quiesce_enqueue (this, stub); return 0; } int32_t -quiesce_rename (call_frame_t *frame, +quiesce_statfs (call_frame_t *frame, xlator_t *this, - loc_t *oldloc, - loc_t *newloc) + loc_t *loc) { quiesce_priv_t *priv = NULL; call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; priv = this->private; - if (priv->pass_through) { + if (priv && priv->pass_through) { + local = mem_get0 (priv->local_pool); + loc_dup (loc, &local->loc); + frame->local = local; + STACK_WIND (frame, - default_rename_cbk, + quiesce_statfs_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->rename, - oldloc, newloc); + FIRST_CHILD(this)->fops->statfs, + loc); return 0; } - stub = fop_rename_stub (frame, default_rename_resume, oldloc, newloc); + stub = fop_statfs_stub (frame, default_statfs_resume, loc); if (!stub) { - STACK_UNWIND_STRICT (rename, frame, -1, ENOMEM, - NULL, NULL, NULL, NULL, NULL); + STACK_UNWIND_STRICT (statfs, frame, -1, ENOMEM, NULL); return 0; } - gf_quiesce_enqueue (priv, stub); + gf_quiesce_enqueue (this, stub); return 0; } - -int -quiesce_symlink (call_frame_t *frame, xlator_t *this, - const char *linkpath, loc_t *loc, dict_t *params) +int32_t +quiesce_fsyncdir (call_frame_t *frame, + xlator_t *this, + fd_t *fd, + int32_t flags) { quiesce_priv_t *priv = NULL; call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; priv = this->private; - if (priv->pass_through) { - STACK_WIND (frame, default_symlink_cbk, + if (priv && priv->pass_through) { + local = mem_get0 (priv->local_pool); + local->fd = fd_ref (fd); + local->flag = flags; + frame->local = local; + + STACK_WIND (frame, + quiesce_fsyncdir_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->symlink, - linkpath, loc, params); + FIRST_CHILD(this)->fops->fsyncdir, + fd, + flags); return 0; } - stub = fop_symlink_stub (frame, default_symlink_resume, - linkpath, loc, params); + stub = fop_fsyncdir_stub (frame, default_fsyncdir_resume, fd, flags); if (!stub) { - STACK_UNWIND_STRICT (symlink, frame, -1, ENOMEM, - NULL, NULL, NULL, NULL); + STACK_UNWIND_STRICT (fsyncdir, frame, -1, ENOMEM); return 0; } - gf_quiesce_enqueue (priv, stub); + gf_quiesce_enqueue (this, stub); return 0; } - -int -quiesce_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags) +int32_t +quiesce_opendir (call_frame_t *frame, + xlator_t *this, + loc_t *loc, fd_t *fd) { quiesce_priv_t *priv = NULL; call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; priv = this->private; - if (priv->pass_through) { - STACK_WIND (frame, default_rmdir_cbk, + if (priv && priv->pass_through) { + local = mem_get0 (priv->local_pool); + loc_dup (loc, &local->loc); + local->fd = fd_ref (fd); + frame->local = local; + + STACK_WIND (frame, + quiesce_opendir_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->rmdir, - loc, flags); + FIRST_CHILD(this)->fops->opendir, + loc, fd); return 0; } - stub = fop_rmdir_stub (frame, default_rmdir_resume, loc, flags); + stub = fop_opendir_stub (frame, default_opendir_resume, loc, fd); if (!stub) { - STACK_UNWIND_STRICT (rmdir, frame, -1, ENOMEM, NULL, NULL); + STACK_UNWIND_STRICT (opendir, frame, -1, ENOMEM, NULL); return 0; } - gf_quiesce_enqueue (priv, stub); + gf_quiesce_enqueue (this, stub); return 0; } int32_t -quiesce_unlink (call_frame_t *frame, - xlator_t *this, - loc_t *loc) +quiesce_fstat (call_frame_t *frame, + xlator_t *this, + fd_t *fd) { quiesce_priv_t *priv = NULL; call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; priv = this->private; - if (priv->pass_through) { + if (priv && priv->pass_through) { + local = mem_get0 (priv->local_pool); + local->fd = fd_ref (fd); + frame->local = local; + STACK_WIND (frame, - default_unlink_cbk, + quiesce_fstat_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->unlink, - loc); + FIRST_CHILD(this)->fops->fstat, + fd); return 0; } - stub = fop_unlink_stub (frame, default_unlink_resume, loc); + stub = fop_fstat_stub (frame, default_fstat_resume, fd); if (!stub) { - STACK_UNWIND_STRICT (unlink, frame, -1, ENOMEM, NULL, NULL); + STACK_UNWIND_STRICT (fstat, frame, -1, ENOMEM, NULL); return 0; } - gf_quiesce_enqueue (priv, stub); + gf_quiesce_enqueue (this, stub); return 0; } -int -quiesce_mkdir (call_frame_t *frame, xlator_t *this, - loc_t *loc, mode_t mode, dict_t *params) +int32_t +quiesce_fsync (call_frame_t *frame, + xlator_t *this, + fd_t *fd, + int32_t flags) { quiesce_priv_t *priv = NULL; call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; priv = this->private; - if (priv->pass_through) { - STACK_WIND (frame, default_mkdir_cbk, + if (priv && priv->pass_through) { + local = mem_get0 (priv->local_pool); + local->fd = fd_ref (fd); + local->flag = flags; + frame->local = local; + + STACK_WIND (frame, + quiesce_fsync_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->mkdir, - loc, mode, params); + FIRST_CHILD(this)->fops->fsync, + fd, + flags); return 0; } - stub = fop_mkdir_stub (frame, default_mkdir_resume, - loc, mode, params); + stub = fop_fsync_stub (frame, default_fsync_resume, fd, flags); if (!stub) { - STACK_UNWIND_STRICT (mkdir, frame, -1, ENOMEM, - NULL, NULL, NULL, NULL); + STACK_UNWIND_STRICT (fsync, frame, -1, ENOMEM, NULL, NULL); return 0; } - gf_quiesce_enqueue (priv, stub); + gf_quiesce_enqueue (this, stub); return 0; } - -int -quiesce_mknod (call_frame_t *frame, xlator_t *this, - loc_t *loc, mode_t mode, dev_t rdev, dict_t *parms) +int32_t +quiesce_flush (call_frame_t *frame, + xlator_t *this, + fd_t *fd) { quiesce_priv_t *priv = NULL; call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; priv = this->private; - if (priv->pass_through) { - STACK_WIND (frame, default_mknod_cbk, + if (priv && priv->pass_through) { + local = mem_get0 (priv->local_pool); + local->fd = fd_ref (fd); + frame->local = local; + + STACK_WIND (frame, + quiesce_flush_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->mknod, - loc, mode, rdev, parms); + FIRST_CHILD(this)->fops->flush, + fd); return 0; } - stub = fop_mknod_stub (frame, default_mknod_resume, - loc, mode, rdev, parms); + stub = fop_flush_stub (frame, default_flush_resume, fd); if (!stub) { - STACK_UNWIND_STRICT (mknod, frame, -1, ENOMEM, - NULL, NULL, NULL, NULL); + STACK_UNWIND_STRICT (flush, frame, -1, ENOMEM); return 0; } - gf_quiesce_enqueue (priv, stub); + gf_quiesce_enqueue (this, stub); return 0; } int32_t -quiesce_readlink (call_frame_t *frame, - xlator_t *this, - loc_t *loc, - size_t size) +quiesce_writev (call_frame_t *frame, + xlator_t *this, + fd_t *fd, + struct iovec *vector, + int32_t count, + off_t off, + struct iobref *iobref) { quiesce_priv_t *priv = NULL; call_stub_t *stub = NULL; priv = this->private; - if (priv->pass_through) { + if (priv && priv->pass_through) { STACK_WIND (frame, - default_readlink_cbk, + default_writev_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->readlink, - loc, - size); + FIRST_CHILD(this)->fops->writev, + fd, + vector, + count, + off, + iobref); return 0; } - stub = fop_readlink_stub (frame, default_readlink_resume, loc, size); + stub = fop_writev_stub (frame, default_writev_resume, + fd, vector, count, off, iobref); if (!stub) { - STACK_UNWIND_STRICT (readlink, frame, -1, ENOMEM, NULL, NULL); + STACK_UNWIND_STRICT (writev, frame, -1, ENOMEM, NULL, NULL); return 0; } - gf_quiesce_enqueue (priv, stub); + gf_quiesce_enqueue (this, stub); return 0; } - int32_t -quiesce_access (call_frame_t *frame, - xlator_t *this, - loc_t *loc, - int32_t mask) +quiesce_readv (call_frame_t *frame, + xlator_t *this, + fd_t *fd, + size_t size, + off_t offset) { quiesce_priv_t *priv = NULL; call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; priv = this->private; - if (priv->pass_through) { + if (priv && priv->pass_through) { + local = mem_get0 (priv->local_pool); + local->fd = fd_ref (fd); + local->size = size; + local->offset = offset; + frame->local = local; + STACK_WIND (frame, - default_access_cbk, + quiesce_readv_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->access, - loc, - mask); + FIRST_CHILD(this)->fops->readv, + fd, + size, + offset); return 0; } - stub = fop_access_stub (frame, default_access_resume, loc, mask); + stub = fop_readv_stub (frame, default_readv_resume, fd, size, offset); if (!stub) { - STACK_UNWIND_STRICT (access, frame, -1, ENOMEM); + STACK_UNWIND_STRICT (readv, frame, -1, ENOMEM, + NULL, 0, NULL, NULL); return 0; } - gf_quiesce_enqueue (priv, stub); + gf_quiesce_enqueue (this, stub); return 0; } + int32_t -quiesce_ftruncate (call_frame_t *frame, - xlator_t *this, - fd_t *fd, - off_t offset) +quiesce_open (call_frame_t *frame, + xlator_t *this, + loc_t *loc, + int32_t flags, fd_t *fd, + int32_t wbflags) { quiesce_priv_t *priv = NULL; call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; priv = this->private; - if (priv->pass_through) { + if (priv && priv->pass_through) { + local = mem_get0 (priv->local_pool); + loc_dup (loc, &local->loc); + local->fd = fd_ref (fd); + + /* Don't send O_APPEND below, as write() re-transmittions can + fail with O_APPEND */ + local->flag = (flags & ~O_APPEND); + local->wbflags = wbflags; + frame->local = local; + STACK_WIND (frame, - default_ftruncate_cbk, + quiesce_open_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->ftruncate, - fd, - offset); + FIRST_CHILD(this)->fops->open, + loc, (flags & ~O_APPEND), fd, wbflags); return 0; } - stub = fop_ftruncate_stub (frame, default_ftruncate_resume, fd, offset); + stub = fop_open_stub (frame, default_open_resume, loc, + (flags & ~O_APPEND), fd, wbflags); if (!stub) { - STACK_UNWIND_STRICT (ftruncate, frame, -1, ENOMEM, NULL, NULL); + STACK_UNWIND_STRICT (open, frame, -1, ENOMEM, NULL); return 0; } - gf_quiesce_enqueue (priv, stub); + gf_quiesce_enqueue (this, stub); return 0; } @@ -852,12 +1970,20 @@ quiesce_getxattr (call_frame_t *frame, { quiesce_priv_t *priv = NULL; call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; priv = this->private; - if (priv->pass_through) { + if (priv && priv->pass_through) { + local = mem_get0 (priv->local_pool); + loc_dup (loc, &local->loc); + if (name) + local->name = gf_strdup (name); + + frame->local = local; + STACK_WIND (frame, - default_getxattr_cbk, + quiesce_getxattr_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->getxattr, loc, @@ -871,7 +1997,7 @@ quiesce_getxattr (call_frame_t *frame, return 0; } - gf_quiesce_enqueue (priv, stub); + gf_quiesce_enqueue (this, stub); return 0; } @@ -889,7 +2015,7 @@ quiesce_xattrop (call_frame_t *frame, priv = this->private; - if (priv->pass_through) { + if (priv && priv->pass_through) { STACK_WIND (frame, default_xattrop_cbk, FIRST_CHILD(this), @@ -907,7 +2033,7 @@ quiesce_xattrop (call_frame_t *frame, return 0; } - gf_quiesce_enqueue (priv, stub); + gf_quiesce_enqueue (this, stub); return 0; } @@ -924,7 +2050,7 @@ quiesce_fxattrop (call_frame_t *frame, priv = this->private; - if (priv->pass_through) { + if (priv && priv->pass_through) { STACK_WIND (frame, default_fxattrop_cbk, FIRST_CHILD(this), @@ -942,40 +2068,7 @@ quiesce_fxattrop (call_frame_t *frame, return 0; } - gf_quiesce_enqueue (priv, stub); - - return 0; -} - -int32_t -quiesce_removexattr (call_frame_t *frame, - xlator_t *this, - loc_t *loc, - const char *name) -{ - quiesce_priv_t *priv = NULL; - call_stub_t *stub = NULL; - - priv = this->private; - - if (priv->pass_through) { - STACK_WIND (frame, - default_removexattr_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->removexattr, - loc, - name); - return 0; - } - - stub = fop_removexattr_stub (frame, default_removexattr_resume, - loc, name); - if (!stub) { - STACK_UNWIND_STRICT (removexattr, frame, -1, ENOMEM); - return 0; - } - - gf_quiesce_enqueue (priv, stub); + gf_quiesce_enqueue (this, stub); return 0; } @@ -992,7 +2085,7 @@ quiesce_lk (call_frame_t *frame, priv = this->private; - if (priv->pass_through) { + if (priv && priv->pass_through) { STACK_WIND (frame, default_lk_cbk, FIRST_CHILD(this), @@ -1009,7 +2102,7 @@ quiesce_lk (call_frame_t *frame, return 0; } - gf_quiesce_enqueue (priv, stub); + gf_quiesce_enqueue (this, stub); return 0; } @@ -1025,7 +2118,7 @@ quiesce_inodelk (call_frame_t *frame, xlator_t *this, priv = this->private; - if (priv->pass_through) { + if (priv && priv->pass_through) { STACK_WIND (frame, default_inodelk_cbk, FIRST_CHILD(this), @@ -1041,7 +2134,7 @@ quiesce_inodelk (call_frame_t *frame, xlator_t *this, return 0; } - gf_quiesce_enqueue (priv, stub); + gf_quiesce_enqueue (this, stub); return 0; } @@ -1055,7 +2148,7 @@ quiesce_finodelk (call_frame_t *frame, xlator_t *this, priv = this->private; - if (priv->pass_through) { + if (priv && priv->pass_through) { STACK_WIND (frame, default_finodelk_cbk, FIRST_CHILD(this), @@ -1071,7 +2164,7 @@ quiesce_finodelk (call_frame_t *frame, xlator_t *this, return 0; } - gf_quiesce_enqueue (priv, stub); + gf_quiesce_enqueue (this, stub); return 0; } @@ -1086,7 +2179,7 @@ quiesce_entrylk (call_frame_t *frame, xlator_t *this, priv = this->private; - if (priv->pass_through) { + if (priv && priv->pass_through) { STACK_WIND (frame, default_entrylk_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->entrylk, @@ -1101,7 +2194,7 @@ quiesce_entrylk (call_frame_t *frame, xlator_t *this, return 0; } - gf_quiesce_enqueue (priv, stub); + gf_quiesce_enqueue (this, stub); return 0; } @@ -1116,7 +2209,7 @@ quiesce_fentrylk (call_frame_t *frame, xlator_t *this, priv = this->private; - if (priv->pass_through) { + if (priv && priv->pass_through) { STACK_WIND (frame, default_fentrylk_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->fentrylk, @@ -1131,7 +2224,7 @@ quiesce_fentrylk (call_frame_t *frame, xlator_t *this, return 0; } - gf_quiesce_enqueue (priv, stub); + gf_quiesce_enqueue (this, stub); return 0; } @@ -1144,12 +2237,19 @@ quiesce_rchecksum (call_frame_t *frame, { quiesce_priv_t *priv = NULL; call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; priv = this->private; - if (priv->pass_through) { + if (priv && priv->pass_through) { + local = mem_get0 (priv->local_pool); + local->fd = fd_ref (fd); + local->offset = offset; + local->flag = len; + frame->local = local; + STACK_WIND (frame, - default_rchecksum_cbk, + quiesce_rchecksum_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->rchecksum, fd, offset, len); @@ -1163,7 +2263,7 @@ quiesce_rchecksum (call_frame_t *frame, return 0; } - gf_quiesce_enqueue (priv, stub); + gf_quiesce_enqueue (this, stub); return 0; } @@ -1178,12 +2278,19 @@ quiesce_readdir (call_frame_t *frame, { quiesce_priv_t *priv = NULL; call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; priv = this->private; - if (priv->pass_through) { + if (priv && priv->pass_through) { + local = mem_get0 (priv->local_pool); + local->fd = fd_ref (fd); + local->size = size; + local->offset = off; + frame->local = local; + STACK_WIND (frame, - default_readdir_cbk, + quiesce_readdir_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->readdir, fd, size, off); @@ -1196,7 +2303,7 @@ quiesce_readdir (call_frame_t *frame, return 0; } - gf_quiesce_enqueue (priv, stub); + gf_quiesce_enqueue (this, stub); return 0; } @@ -1211,12 +2318,19 @@ quiesce_readdirp (call_frame_t *frame, { quiesce_priv_t *priv = NULL; call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; priv = this->private; - if (priv->pass_through) { + if (priv && priv->pass_through) { + local = mem_get0 (priv->local_pool); + local->fd = fd_ref (fd); + local->size = size; + local->offset = off; + frame->local = local; + STACK_WIND (frame, - default_readdirp_cbk, + quiesce_readdirp_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->readdirp, fd, size, off); @@ -1229,7 +2343,7 @@ quiesce_readdirp (call_frame_t *frame, return 0; } - gf_quiesce_enqueue (priv, stub); + gf_quiesce_enqueue (this, stub); return 0; } @@ -1246,7 +2360,7 @@ quiesce_setattr (call_frame_t *frame, priv = this->private; - if (priv->pass_through) { + if (priv && priv->pass_through) { STACK_WIND (frame, default_setattr_cbk, FIRST_CHILD (this), @@ -1262,42 +2376,11 @@ quiesce_setattr (call_frame_t *frame, return 0; } - gf_quiesce_enqueue (priv, stub); + gf_quiesce_enqueue (this, stub); return 0; } -int32_t -quiesce_truncate (call_frame_t *frame, - xlator_t *this, - loc_t *loc, - off_t offset) -{ - quiesce_priv_t *priv = NULL; - call_stub_t *stub = NULL; - - priv = this->private; - - if (priv->pass_through) { - STACK_WIND (frame, - default_truncate_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->truncate, - loc, - offset); - return 0; - } - - stub = fop_truncate_stub (frame, default_truncate_resume, loc, offset); - if (!stub) { - STACK_UNWIND_STRICT (truncate, frame, -1, ENOMEM, NULL, NULL); - return 0; - } - - gf_quiesce_enqueue (priv, stub); - - return 0; -} int32_t quiesce_stat (call_frame_t *frame, @@ -1306,12 +2389,17 @@ quiesce_stat (call_frame_t *frame, { quiesce_priv_t *priv = NULL; call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; priv = this->private; - if (priv->pass_through) { + if (priv && priv->pass_through) { + local = mem_get0 (priv->local_pool); + loc_dup (loc, &local->loc); + frame->local = local; + STACK_WIND (frame, - default_stat_cbk, + quiesce_stat_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->stat, loc); @@ -1324,7 +2412,7 @@ quiesce_stat (call_frame_t *frame, return 0; } - gf_quiesce_enqueue (priv, stub); + gf_quiesce_enqueue (this, stub); return 0; } @@ -1337,12 +2425,18 @@ quiesce_lookup (call_frame_t *frame, { quiesce_priv_t *priv = NULL; call_stub_t *stub = NULL; + quiesce_local_t *local = NULL; priv = this->private; - if (priv->pass_through) { + if (priv && priv->pass_through) { + local = mem_get0 (priv->local_pool); + loc_dup (loc, &local->loc); + local->dict = dict_ref (xattr_req); + frame->local = local; + STACK_WIND (frame, - default_lookup_cbk, + quiesce_lookup_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->lookup, loc, @@ -1357,7 +2451,7 @@ quiesce_lookup (call_frame_t *frame, return 0; } - gf_quiesce_enqueue (priv, stub); + gf_quiesce_enqueue (this, stub); return 0; } @@ -1374,7 +2468,7 @@ quiesce_fsetattr (call_frame_t *frame, priv = this->private; - if (priv->pass_through) { + if (priv && priv->pass_through) { STACK_WIND (frame, default_fsetattr_cbk, FIRST_CHILD (this), @@ -1390,7 +2484,7 @@ quiesce_fsetattr (call_frame_t *frame, return 0; } - gf_quiesce_enqueue (priv, stub); + gf_quiesce_enqueue (this, stub); return 0; } @@ -1426,6 +2520,9 @@ init (xlator_t *this) if (!priv) goto out; + priv->local_pool = mem_pool_new (quiesce_local_t, + GF_FOPS_EXPECTED_IN_PARALLEL); + LOCK_INIT (&priv->lock); priv->pass_through = _gf_false; @@ -1447,6 +2544,7 @@ fini (xlator_t *this) goto out; this->private = NULL; + mem_pool_destroy (priv->local_pool); LOCK_DESTROY (&priv->lock); GF_FREE (priv); out: @@ -1488,21 +2586,21 @@ notify (xlator_t *this, int event, void *data, ...) } UNLOCK (&priv->lock); - if (!priv->timer) { - timeout.tv_sec = 20; - timeout.tv_usec = 0; + if (priv->timer) + break; + timeout.tv_sec = 20; + timeout.tv_usec = 0; - gf_timer_call_cancel (this->ctx, priv->timer); - priv->timer = gf_timer_call_after (this->ctx, - timeout, - gf_quiesce_timeout, - (void *) this); + priv->timer = gf_timer_call_after (this->ctx, + timeout, + gf_quiesce_timeout, + (void *) this); - if (priv->timer == NULL) { - gf_log (this->name, GF_LOG_ERROR, - "Cannot create timer"); - } + if (priv->timer == NULL) { + gf_log (this->name, GF_LOG_ERROR, + "Cannot create timer"); } + break; default: break; @@ -1515,35 +2613,23 @@ out: struct xlator_fops fops = { - .lookup = quiesce_lookup, + /* write/modifying fops */ .mknod = quiesce_mknod, .create = quiesce_create, - .stat = quiesce_stat, - .fstat = quiesce_fstat, .truncate = quiesce_truncate, .ftruncate = quiesce_ftruncate, - .access = quiesce_access, - .readlink = quiesce_readlink, .setxattr = quiesce_setxattr, - .getxattr = quiesce_getxattr, .removexattr = quiesce_removexattr, - .open = quiesce_open, - .readv = quiesce_readv, - .writev = quiesce_writev, - .flush = quiesce_flush, - .fsync = quiesce_fsync, - .statfs = quiesce_statfs, - .lk = quiesce_lk, - .opendir = quiesce_opendir, - .readdir = quiesce_readdir, - .readdirp = quiesce_readdirp, - .fsyncdir = quiesce_fsyncdir, .symlink = quiesce_symlink, .unlink = quiesce_unlink, .link = quiesce_link, .mkdir = quiesce_mkdir, .rmdir = quiesce_rmdir, .rename = quiesce_rename, + + /* The below calls are known to change state, hence + re-transmittion is not advised */ + .lk = quiesce_lk, .inodelk = quiesce_inodelk, .finodelk = quiesce_finodelk, .entrylk = quiesce_entrylk, @@ -1552,6 +2638,29 @@ struct xlator_fops fops = { .fxattrop = quiesce_fxattrop, .setattr = quiesce_setattr, .fsetattr = quiesce_fsetattr, + + /* Special case, re-transmittion is not harmful * + * as offset is properly sent from above layers */ + /* TODO: not re-transmitted as of now */ + .writev = quiesce_writev, + + /* re-transmittable fops */ + .lookup = quiesce_lookup, + .stat = quiesce_stat, + .fstat = quiesce_fstat, + .access = quiesce_access, + .readlink = quiesce_readlink, + .getxattr = quiesce_getxattr, + .open = quiesce_open, + .readv = quiesce_readv, + .flush = quiesce_flush, + .fsync = quiesce_fsync, + .statfs = quiesce_statfs, + .opendir = quiesce_opendir, + .readdir = quiesce_readdir, + .readdirp = quiesce_readdirp, + .fsyncdir = quiesce_fsyncdir, + }; struct xlator_dumpops dumpops = { diff --git a/xlators/features/quiesce/src/quiesce.h b/xlators/features/quiesce/src/quiesce.h index 2e1a560e2..45eea34a2 100644 --- a/xlators/features/quiesce/src/quiesce.h +++ b/xlators/features/quiesce/src/quiesce.h @@ -25,6 +25,8 @@ #include "xlator.h" #include "timer.h" +#define GF_FOPS_EXPECTED_IN_PARALLEL 4096 + typedef struct { gf_timer_t *timer; gf_boolean_t pass_through; @@ -32,6 +34,27 @@ typedef struct { struct list_head req; int queue_size; pthread_t thr; + struct mem_pool *local_pool; } quiesce_priv_t; +typedef struct { + fd_t *fd; + char *name; + char *volname; + loc_t loc; + off_t size; + off_t offset; + mode_t mode; + int32_t flag; + struct iatt stbuf; + struct iovec *vector; + struct iobref *iobref; + dict_t *dict; + struct gf_flock flock; + entrylk_cmd cmd; + entrylk_type type; + gf_xattrop_flags_t xattrop_flags; + int32_t wbflags; +} quiesce_local_t; + #endif -- cgit