libxlator: New policy for aggregation of xtime:

-Try to salvage errors like ENOENT/ENOTCONN/ENODATA,
               -Propogate back any other error from any brick
               -EINVAL if some assertion of the aggregation logic is broken

Signed-off-by: Kaushik BV <kaushikbv@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>

BUG: 2341 ([glusterfs-3.1.2gsyncqa4]: crash in gsyncd)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2341
This commit is contained in:
Kaushik BV 2011-02-03 23:16:03 +00:00 committed by Anand V. Avati
parent 7f59d855bb
commit ba40a3ece0
2 changed files with 57 additions and 16 deletions

View File

@ -64,8 +64,25 @@ cluster_markerxtime_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
goto out;
}
if (local->esomerr) {
LOCK (&frame->lock);
{
callcnt = --local->call_count;
}
goto done;
}
vol_uuid = local->vol_uuid;
if (op_ret && op_errno == ENODATA) {
LOCK (&frame->lock);
{
callcnt = --local->call_count;
local->enodata_count++;
}
goto done;
}
if (op_ret && op_errno == ENOENT) {
LOCK (&frame->lock);
{
@ -84,6 +101,17 @@ cluster_markerxtime_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
goto done;
}
if (op_ret) {
LOCK (&frame->lock);
{
callcnt = --local->call_count;
local->esomerr = op_errno;
}
goto done;
}
LOCK (&frame->lock);
{
@ -91,14 +119,14 @@ cluster_markerxtime_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (!gf_asprintf (& marker_xattr, "%s.%s.%s",
MARKER_XATTR_PREFIX, vol_uuid, XTIME)) {
op_errno = ENOMEM;
goto out;
goto done;
}
if (dict_get_ptr (dict, marker_xattr, (void **)&net_timebuf)) {
gf_log (this->name, GF_LOG_WARNING,
"Unable to get <uuid>.xtime attr");
local->noxtime_count++;
goto done;
}
@ -147,21 +175,30 @@ done:
op_errno = ENOMEM;
goto out;
}
goto out;
}
if (local->noxtime_count)
goto out;
if (local->enodata_count) {
op_ret = -1;
op_errno = ENODATA;
goto out;
}
if (local->enotconn_count) {
op_ret = -1;
op_errno = ENOTCONN;
goto out;
}
if (local->enoent_count) {
op_ret = -1;
op_errno = ENOENT;
goto out;
}
else {
op_ret = -1;
if (local->enotconn_count) {
op_errno = ENOTCONN;
goto out;
}
if (local->enoent_count) {
op_errno = ENOENT;
goto out;
}
else {
op_errno = EINVAL;
goto out;
}
op_errno = local->esomerr;
goto out;
}
out:
if (local->xl_specf_unwind) {
@ -241,7 +278,7 @@ cluster_markeruuid_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
(marker->volmark->minor != volmark->minor)) {
op_ret = -1;
op_errno = EINVAL;
goto out;
goto done;
}
else if (volmark->retval) {
data_unref ((data_t *) marker->volmark);

View File

@ -47,6 +47,10 @@ struct marker_str {
unsigned has_xtime:1;
int32_t enoent_count;
int32_t enotconn_count;
int32_t enodata_count;
int32_t noxtime_count;
int esomerr;
xlator_specf_unwind_t xl_specf_unwind;
void *xl_local;