diff options
author | Vikas Gorur <vikas@gluster.com> | 2009-04-07 06:55:15 -0700 |
---|---|---|
committer | Anand V. Avati <avati@amp.gluster.com> | 2009-04-07 23:19:00 +0530 |
commit | d46684117a02359886e096d1bcc9f590b54144a6 (patch) | |
tree | 0f6160978fd6f7399622c6c401cb9ee438154cd9 /xlators | |
parent | d71e72248096d12ce2a8ca7ccb36ef97ae486583 (diff) |
Consider a subvolume dead if an fop fails on it
Transaction fops earlier called afr_transaction_child_died only
if an fop failed due to ENOTCONN or EBADFD. Now they consider a child
dead regardless of the reason for failure. This handles cases such
as ENOSPC.
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/cluster/afr/src/afr-dir-write.c | 18 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr-inode-write.c | 16 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr.h | 2 |
3 files changed, 19 insertions, 17 deletions
diff --git a/xlators/cluster/afr/src/afr-dir-write.c b/xlators/cluster/afr/src/afr-dir-write.c index 5c6c14736..89d38caac 100644 --- a/xlators/cluster/afr/src/afr-dir-write.c +++ b/xlators/cluster/afr/src/afr-dir-write.c @@ -119,7 +119,7 @@ afr_create_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, LOCK (&frame->lock); { - if (child_went_down (op_ret, op_errno)) + if (afr_fop_failed (op_ret, op_errno)) afr_transaction_child_died (frame, this, child_index); if (op_ret != -1) { @@ -348,7 +348,7 @@ afr_mknod_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, LOCK (&frame->lock); { - if (child_went_down (op_ret, op_errno)) + if (afr_fop_failed (op_ret, op_errno)) afr_transaction_child_died (frame, this, child_index); if (op_ret != -1) { @@ -573,7 +573,7 @@ afr_mkdir_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, LOCK (&frame->lock); { - if (child_went_down (op_ret, op_errno)) + if (afr_fop_failed (op_ret, op_errno)) afr_transaction_child_died (frame, this, child_index); if (op_ret != -1) { @@ -800,7 +800,7 @@ afr_link_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, LOCK (&frame->lock); { - if (child_went_down (op_ret, op_errno)) + if (afr_fop_failed (op_ret, op_errno)) afr_transaction_child_died (frame, this, child_index); if (op_ret != -1) { @@ -1025,7 +1025,7 @@ afr_symlink_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, LOCK (&frame->lock); { - if (child_went_down (op_ret, op_errno)) + if (afr_fop_failed (op_ret, op_errno)) afr_transaction_child_died (frame, this, child_index); if (op_ret != -1) { @@ -1250,7 +1250,7 @@ afr_rename_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, LOCK (&frame->lock); { - if (child_went_down (op_ret, op_errno)) + if (afr_fop_failed (op_ret, op_errno)) afr_transaction_child_died (frame, this, child_index); if ((op_ret != -1) && (local->success_count == 0)) { @@ -1443,7 +1443,7 @@ afr_unlink_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, LOCK (&frame->lock); { - if (child_went_down (op_ret, op_errno)) + if (afr_fop_failed (op_ret, op_errno)) afr_transaction_child_died (frame, this, child_index); if (op_ret != -1) { @@ -1631,7 +1631,7 @@ afr_rmdir_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, LOCK (&frame->lock); { - if (child_went_down (op_ret, op_errno)) + if (afr_fop_failed (op_ret, op_errno)) afr_transaction_child_died (frame, this, child_index); if (op_ret != -1) { @@ -1791,7 +1791,7 @@ afr_setdents_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, LOCK (&frame->lock); { - if (child_went_down (op_ret, op_errno)) + if (afr_fop_failed (op_ret, op_errno)) afr_transaction_child_died (frame, this, child_index); if ((op_ret != -1) && (local->success_count == 0)) { diff --git a/xlators/cluster/afr/src/afr-inode-write.c b/xlators/cluster/afr/src/afr-inode-write.c index cf4d493a4..025bf8af4 100644 --- a/xlators/cluster/afr/src/afr-inode-write.c +++ b/xlators/cluster/afr/src/afr-inode-write.c @@ -94,7 +94,7 @@ afr_chmod_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, LOCK (&frame->lock); { - if (child_went_down (op_ret, op_errno)) + if (afr_fop_failed (op_ret, op_errno)) afr_transaction_child_died (frame, this, child_index); if (op_ret != -1) { @@ -289,7 +289,7 @@ afr_fchmod_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, LOCK (&frame->lock); { - if (child_went_down (op_ret, op_errno)) + if (afr_fop_failed (op_ret, op_errno)) afr_transaction_child_died (frame, this, child_index); if (op_ret != -1) { @@ -483,7 +483,7 @@ afr_chown_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, LOCK (&frame->lock); { - if (child_went_down (op_ret, op_errno)) + if (afr_fop_failed (op_ret, op_errno)) afr_transaction_child_died (frame, this, child_index); if (op_ret != -1) { @@ -681,7 +681,7 @@ afr_fchown_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, LOCK (&frame->lock); { - if (child_went_down (op_ret, op_errno)) + if (afr_fop_failed (op_ret, op_errno)) afr_transaction_child_died (frame, this, child_index); if (op_ret != -1) { @@ -878,7 +878,7 @@ afr_writev_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, LOCK (&frame->lock); { - if (child_went_down (op_ret, op_errno)) + if (afr_fop_failed (op_ret, op_errno)) afr_transaction_child_died (frame, this, child_index); if (op_ret != -1) { @@ -1092,7 +1092,7 @@ afr_truncate_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, LOCK (&frame->lock); { - if (child_went_down (op_ret, op_errno)) + if (afr_fop_failed (op_ret, op_errno)) afr_transaction_child_died (frame, this, child_index); if (op_ret != -1) { @@ -1291,7 +1291,7 @@ afr_ftruncate_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, LOCK (&frame->lock); { - if (child_went_down (op_ret, op_errno)) + if (afr_fop_failed (op_ret, op_errno)) afr_transaction_child_died (frame, this, child_index); if (op_ret != -1) { @@ -1489,7 +1489,7 @@ afr_utimens_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, LOCK (&frame->lock); { - if (child_went_down (op_ret, op_errno)) + if (afr_fop_failed (op_ret, op_errno)) afr_transaction_child_died (frame, this, child_index); if (op_ret != -1) { diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h index ac1a5f6ad..76ccec2ae 100644 --- a/xlators/cluster/afr/src/afr.h +++ b/xlators/cluster/afr/src/afr.h @@ -411,6 +411,8 @@ typedef struct _afr_local { ((op_errno == ENOTCONN) || \ (op_errno == EBADFD))) +#define afr_fop_failed(op_ret, op_errno) ((op_ret) == -1) + /* have we tried all children? */ #define all_tried(i, count) ((i) == (count) - 1) |