summaryrefslogtreecommitdiffstats
path: root/xlators/performance/open-behind
diff options
context:
space:
mode:
authorAnand Avati <avati@redhat.com>2013-02-15 17:30:56 -0800
committerAnand Avati <avati@redhat.com>2013-02-20 00:39:41 -0800
commite7fc8a2ca16b397ec69575aa22b179ef47410e46 (patch)
tree3da52e2ceb8ff9556e4c52c082b88a17e36e4d64 /xlators/performance/open-behind
parent01bb20f4aa42f735b72baff72ea770289851b46c (diff)
open-behind: propagate errors from ob_wake_cbk
If opening fd in background fails, then remember the error and fail all further calls on the fd. Use the newly introduced call_unwind_error() function from call-stub cleanup to fail the future calls. Change-Id: I3b09b7969c98d915abd56590a2777ce833b81813 BUG: 846240 Signed-off-by: Anand Avati <avati@redhat.com> Reviewed-on: http://review.gluster.org/4521 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
Diffstat (limited to 'xlators/performance/open-behind')
-rw-r--r--xlators/performance/open-behind/src/open-behind.c34
1 files changed, 25 insertions, 9 deletions
diff --git a/xlators/performance/open-behind/src/open-behind.c b/xlators/performance/open-behind/src/open-behind.c
index ec5f62580af..e23a2332514 100644
--- a/xlators/performance/open-behind/src/open-behind.c
+++ b/xlators/performance/open-behind/src/open-behind.c
@@ -31,6 +31,7 @@ typedef struct ob_fd {
loc_t loc;
dict_t *xdata;
int flags;
+ int op_errno;
struct list_head list;
} ob_fd_t;
@@ -136,26 +137,33 @@ ob_wake_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
fd = frame->local;
frame->local = NULL;
+ INIT_LIST_HEAD (&list);
+
LOCK (&fd->lock);
{
ob_fd = __ob_fd_ctx_get (this, fd);
- __fd_ctx_del (fd, this, NULL);
+ list_splice_init (&ob_fd->list, &list);
+
+ if (op_ret < 0) {
+ /* mark fd BAD for ever */
+ ob_fd->op_errno = op_errno;
+ } else {
+ __fd_ctx_del (fd, this, NULL);
+ ob_fd_free (ob_fd);
+ }
}
UNLOCK (&fd->lock);
- INIT_LIST_HEAD (&list);
-
- list_splice_init (&ob_fd->list, &list);
-
list_for_each_entry_safe (stub, tmp, &list, list) {
list_del_init (&stub->list);
- call_resume (stub);
+ if (op_ret < 0)
+ call_unwind_error (stub, -1, op_errno);
+ else
+ call_resume (stub);
}
- ob_fd_free (ob_fd);
-
fd_unref (fd);
STACK_DESTROY (frame->root);
@@ -198,6 +206,7 @@ int
open_and_resume (xlator_t *this, fd_t *fd, call_stub_t *stub)
{
ob_fd_t *ob_fd = NULL;
+ int op_errno = 0;
if (!fd)
goto nofd;
@@ -208,13 +217,20 @@ open_and_resume (xlator_t *this, fd_t *fd, call_stub_t *stub)
if (!ob_fd)
goto unlock;
+ if (ob_fd->op_errno) {
+ op_errno = ob_fd->op_errno;
+ goto unlock;
+ }
+
list_add_tail (&stub->list, &ob_fd->list);
}
unlock:
UNLOCK (&fd->lock);
nofd:
- if (ob_fd)
+ if (op_errno)
+ call_unwind_error (stub, -1, op_errno);
+ else if (ob_fd)
ob_fd_wake (this, fd);
else
call_resume (stub);