From 95ff42b7de403249ef5df451ec9ae0b4319f6997 Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Tue, 16 May 2017 10:07:31 +0200 Subject: [PATCH] logger: disable irqs during spinlocks --- kernel/mars_trans_logger.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/kernel/mars_trans_logger.c b/kernel/mars_trans_logger.c index 39c0fd3d..1913c8c2 100644 --- a/kernel/mars_trans_logger.c +++ b/kernel/mars_trans_logger.c @@ -117,18 +117,22 @@ EXPORT_SYMBOL_GPL(global_writeback); static void add_to_group(struct writeback_group *gr, struct trans_logger_brick *brick) { - write_lock(&gr->lock); + unsigned long flags; + + write_lock_irqsave(&gr->lock, flags); list_add_tail(&brick->group_head, &gr->group_anchor); - write_unlock(&gr->lock); + write_unlock_irqrestore(&gr->lock, flags); } static void remove_from_group(struct writeback_group *gr, struct trans_logger_brick *brick) { - write_lock(&gr->lock); + unsigned long flags; + + write_lock_irqsave(&gr->lock, flags); list_del_init(&brick->group_head); gr->leader = NULL; - write_unlock(&gr->lock); + write_unlock_irqrestore(&gr->lock, flags); } static @@ -136,6 +140,7 @@ struct trans_logger_brick *elect_leader(struct writeback_group *gr) { struct trans_logger_brick *res = gr->leader; struct list_head *tmp; + unsigned long flags; if (res && gr->until_percent >= 0) { loff_t used = atomic64_read(&res->shadow_mem_used); @@ -143,7 +148,7 @@ struct trans_logger_brick *elect_leader(struct writeback_group *gr) goto done; } - read_lock(&gr->lock); + read_lock_irqsave(&gr->lock, flags); for (tmp = gr->group_anchor.next; tmp != &gr->group_anchor; tmp = tmp->next) { struct trans_logger_brick *test = container_of(tmp, struct trans_logger_brick, group_head); loff_t new_used = atomic64_read(&test->shadow_mem_used); @@ -153,7 +158,7 @@ struct trans_logger_brick *elect_leader(struct writeback_group *gr) gr->biggest = new_used; } } - read_unlock(&gr->lock); + read_unlock_irqrestore(&gr->lock, flags); gr->leader = res;