main: disable irqs during spinlocks

This commit is contained in:
Thomas Schoebel-Theuer 2017-05-16 10:21:31 +02:00
parent 386ae8e8d0
commit 95d10d02a2

View File

@ -1647,8 +1647,9 @@ struct mars_peerinfo *find_peer(const char *peer_name)
{
struct list_head *tmp;
struct mars_peerinfo *res = NULL;
unsigned long flags;
read_lock(&peer_lock);
read_lock_irqsave(&peer_lock, flags);
for (tmp = peer_anchor.next; tmp != &peer_anchor; tmp = tmp->next) {
struct mars_peerinfo *peer = container_of(tmp, struct mars_peerinfo, peer_head);
if (!strcmp(peer->peer, peer_name)) {
@ -1656,7 +1657,7 @@ struct mars_peerinfo *find_peer(const char *peer_name)
break;
}
}
read_unlock(&peer_lock);
read_unlock_irqrestore(&peer_lock, flags);
return res;
}
@ -2273,16 +2274,17 @@ void from_remote_trigger(void)
{
struct list_head *tmp;
int count = 0;
unsigned long flags;
_make_alive();
read_lock(&peer_lock);
read_lock_irqsave(&peer_lock, flags);
for (tmp = peer_anchor.next; tmp != &peer_anchor; tmp = tmp->next) {
struct mars_peerinfo *peer = container_of(tmp, struct mars_peerinfo, peer_head);
peer->from_remote_trigger = true;
count++;
}
read_unlock(&peer_lock);
read_unlock_irqrestore(&peer_lock, flags);
MARS_DBG("got trigger for %d peers\n", count);
wake_up_interruptible_all(&remote_event);
@ -2294,14 +2296,15 @@ void __mars_remote_trigger(void)
{
struct list_head *tmp;
int count = 0;
unsigned long flags;
read_lock(&peer_lock);
read_lock_irqsave(&peer_lock, flags);
for (tmp = peer_anchor.next; tmp != &peer_anchor; tmp = tmp->next) {
struct mars_peerinfo *peer = container_of(tmp, struct mars_peerinfo, peer_head);
peer->to_remote_trigger = true;
count++;
}
read_unlock(&peer_lock);
read_unlock_irqrestore(&peer_lock, flags);
MARS_DBG("triggered %d peers\n", count);
wake_up_interruptible_all(&remote_event);
@ -2343,9 +2346,9 @@ static int _kill_peer(struct mars_global *global, struct mars_peerinfo *peer)
return 0;
}
write_lock(&peer_lock);
write_lock_irqsave(&peer_lock, flags);
list_del_init(&peer->peer_head);
write_unlock(&peer_lock);
write_unlock_irqrestore(&peer_lock, flags);
MARS_INF("stopping peer thread...\n");
if (peer->peer_thread) {
@ -2376,6 +2379,7 @@ static int _make_peer(struct mars_global *global, struct mars_dent *dent, char *
char *mypeer;
char *parent_path;
int status = 0;
unsigned long flags;
if (!global || !dent || !dent->new_link || !dent->d_parent || !(parent_path = dent->d_parent->d_path)) {
MARS_DBG("cannot work\n");
@ -2408,9 +2412,9 @@ static int _make_peer(struct mars_global *global, struct mars_dent *dent, char *
INIT_LIST_HEAD(&peer->peer_head);
INIT_LIST_HEAD(&peer->remote_dent_list);
write_lock(&peer_lock);
write_lock_irqsave(&peer_lock, flags);
list_add_tail(&peer->peer_head, &peer_anchor);
write_unlock(&peer_lock);
write_unlock_irqrestore(&peer_lock, flags);
}
peer = dent->d_private;