From 7cbb705882f40ab40d951fc2984a17b735e2be2c Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Mon, 27 Apr 2015 08:59:43 +0200 Subject: [PATCH] logger: safeguard endio() calling conventions --- kernel/mars_trans_logger.c | 9 +++++++++ kernel/mars_trans_logger.h | 1 + 2 files changed, 10 insertions(+) diff --git a/kernel/mars_trans_logger.c b/kernel/mars_trans_logger.c index c06b312d..1468b81e 100644 --- a/kernel/mars_trans_logger.c +++ b/kernel/mars_trans_logger.c @@ -1540,6 +1540,15 @@ void phase0_endio(void *private, int error) orig_mref_a = private; CHECK_PTR(orig_mref_a, err); + +// remove_this + if (unlikely(cmpxchg(&orig_mref_a->is_endio, false, true))) { + MARS_ERR("Sigh this should not happen %p %p\n", + orig_mref_a, orig_mref_a->object); + return; + } + +// end_remove_this brick = orig_mref_a->my_brick; CHECK_PTR(brick, err); orig_mref = orig_mref_a->object; diff --git a/kernel/mars_trans_logger.h b/kernel/mars_trans_logger.h index dd4b314f..73d21639 100644 --- a/kernel/mars_trans_logger.h +++ b/kernel/mars_trans_logger.h @@ -145,6 +145,7 @@ struct trans_logger_mref_aspect { bool is_collected; bool is_fired; bool is_completed; + bool is_endio; bool is_persistent; bool is_emergency; struct timespec stamp;