--- y/kernel/watch_queue.c +++ w/kernel/watch_queue.c @@ -83,11 +83,13 @@ static bool post_one_notification(struct if (!pipe) return false; + spin_lock_bh(&wqueue->lock); + if (wqueue->defunct) { + spin_unlock_bh(&wqueue->lock); + return false; + } spin_lock_irq(&pipe->rd_wait.lock); - if (wqueue->defunct) - goto out; - mask = pipe->ring_size - 1; head = pipe->head; tail = pipe->tail; @@ -126,6 +128,7 @@ out: spin_unlock_irq(&pipe->rd_wait.lock); if (done) kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN); + spin_unlock_bh(&wqueue->lock); return done; lost: