mirror of
https://github.com/schoebel/mars
synced 2025-02-17 04:26:53 +00:00
logger: fix scarce scheduling deadlock
This commit is contained in:
parent
aa7ef9451b
commit
fac0bd5a47
@ -122,6 +122,7 @@ struct banning {
|
|||||||
// statistical
|
// statistical
|
||||||
int ban_renew_count;
|
int ban_renew_count;
|
||||||
int ban_count;
|
int ban_count;
|
||||||
|
bool ban_hit;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline
|
static inline
|
||||||
@ -133,6 +134,7 @@ bool banning_hit(struct banning *ban, long long duration)
|
|||||||
|
|
||||||
lamport_time_add_ns(&new_hit, duration);
|
lamport_time_add_ns(&new_hit, duration);
|
||||||
ban->ban_renew_count++;
|
ban->ban_renew_count++;
|
||||||
|
ban->ban_hit = true;
|
||||||
if (!lamport_time_to_ns(&ban->ban_last_hit) ||
|
if (!lamport_time_to_ns(&ban->ban_last_hit) ||
|
||||||
lamport_time_compare(&ban->ban_last_hit, &new_hit) < 0) {
|
lamport_time_compare(&ban->ban_last_hit, &new_hit) < 0) {
|
||||||
ban->ban_last_hit = new_hit;
|
ban->ban_last_hit = new_hit;
|
||||||
@ -146,6 +148,12 @@ bool banning_is_hit(struct banning *ban)
|
|||||||
{
|
{
|
||||||
struct lamport_time now = get_real_lamport();
|
struct lamport_time now = get_real_lamport();
|
||||||
|
|
||||||
|
/* always report at least once after a hit */
|
||||||
|
if (ban->ban_hit) {
|
||||||
|
ban->ban_hit = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return lamport_time_compare(&ban->ban_last_hit, &now) >= 0 &&
|
return lamport_time_compare(&ban->ban_last_hit, &now) >= 0 &&
|
||||||
lamport_time_to_ns(&ban->ban_last_hit);
|
lamport_time_to_ns(&ban->ban_last_hit);
|
||||||
}
|
}
|
||||||
|
@ -2476,7 +2476,7 @@ int _do_ranking(struct trans_logger_brick *brick)
|
|||||||
#ifdef CONFIG_MARS_DEBUG
|
#ifdef CONFIG_MARS_DEBUG
|
||||||
brick->bail[i] = 2;
|
brick->bail[i] = 2;
|
||||||
#endif
|
#endif
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user