all: improve checking of callback chain

This commit is contained in:
Thomas Schoebel-Theuer 2014-03-23 10:57:56 +01:00
parent 9ab367f11a
commit c621de770b
7 changed files with 13 additions and 1 deletions

View File

@ -90,6 +90,7 @@ void log_write_endio(struct generic_callback *cb)
struct log_cb_info *cb_info = cb->cb_private;
struct log_status *logst;
LAST_CALLBACK(cb);
CHECK_PTR(cb_info, err);
if (cb_info->mref) {
@ -373,6 +374,7 @@ void log_read_endio(struct generic_callback *cb)
{
struct log_status *logst = cb->cb_private;
LAST_CALLBACK(cb);
CHECK_PTR(logst, err);
logst->error_code = cb->cb_error;
logst->got = true;

View File

@ -688,6 +688,7 @@ static void _buf_endio(struct generic_callback *cb)
int count = 0;
#endif
LAST_CALLBACK(cb);
CHECK_PTR(bf_mref_a, err);
bf_mref = bf_mref_a->object;
CHECK_PTR(bf_mref, err);

View File

@ -188,6 +188,7 @@ void copy_endio(struct generic_callback *cb)
int queue;
int error = 0;
LAST_CALLBACK(cb);
mref_a = cb->cb_private;
CHECK_PTR(mref_a, err);
mref = mref_a->object;

View File

@ -116,6 +116,7 @@ void if_endio(struct generic_callback *cb)
int rw;
int error;
LAST_CALLBACK(cb);
if (unlikely(!mref_a || !mref_a->object)) {
MARS_FAT("mref_a = %p mref = %p, something is very wrong here!\n", mref_a, mref_a->object);
return;

View File

@ -126,9 +126,13 @@ void server_endio(struct generic_callback *cb)
CHECK_PTR(mref_a, err);
mref = mref_a->object;
CHECK_PTR(mref, err);
LAST_CALLBACK(cb);
if (unlikely(cb != &mref->_object_cb)) {
MARS_ERR("bad cb pointer %p != %p\n", cb, &mref->_object_cb);
}
brick = mref_a->brick;
if (!brick) {
if (unlikely(!brick)) {
MARS_WRN("late IO callback -- cannot do anything\n");
return;
}

View File

@ -1125,6 +1125,7 @@ void wb_endio(struct generic_callback *cb)
void (**_endio)(struct generic_callback *cb);
void (*endio)(struct generic_callback *cb);
LAST_CALLBACK(cb);
sub_mref_a = cb->cb_private;
CHECK_PTR(sub_mref_a, err);
sub_mref = sub_mref_a->object;
@ -2663,6 +2664,7 @@ void replay_endio(struct generic_callback *cb)
struct trans_logger_brick *brick;
unsigned long flags;
LAST_CALLBACK(cb);
CHECK_PTR(mref_a, err);
brick = mref_a->my_brick;
CHECK_PTR(brick, err);

View File

@ -57,6 +57,7 @@ static void _usebuf_endio(struct generic_callback *cb)
struct usebuf_mref_aspect *sub_mref_a;
struct mref_object *sub_mref;
LAST_CALLBACK(cb);
CHECK_PTR(mref_a, done);
mref = mref_a->object;
CHECK_PTR(mref, done);