On Mon, Dec 04, 2017 at 03:33:56PM +0100, Martin Pieuchot wrote:
> Diff below change the usage of `sb_flags' and `sb_flagsintr'.  The
> former will be protected by the socket lock while the latter will
> be using atomic operations.

I like this plan.

> @@ -381,17 +381,18 @@ sbunlock(struct socket *so, struct sockb
>  void
>  sowakeup(struct socket *so, struct sockbuf *sb)
>  {
> -     KERNEL_ASSERT_LOCKED();
>       soassertlocked(so);
>  
> -     selwakeup(&sb->sb_sel);
> -     sb->sb_flagsintr &= ~SB_SEL;
> -     if (sb->sb_flagsintr & SB_WAIT) {
> -             sb->sb_flagsintr &= ~SB_WAIT;
> +     sb->sb_flags &= ~SB_SEL;
> +     if (sb->sb_flags & SB_WAIT) {
> +             sb->sb_flags &= ~SB_WAIT;
>               wakeup(&sb->sb_cc);
>       }
> +     KERNEL_LOCK();
>       if (so->so_state & SS_ASYNC)
>               csignal(so->so_pgid, SIGIO, so->so_siguid, so->so_sigeuid);
> +     selwakeup(&sb->sb_sel);
> +     KERNEL_UNLOCK();
>  }

Why do you move the selwakeup() after the csignal() ?

> @@ -340,6 +342,7 @@ fifo_poll(void *v)
>                       wso->so_snd.sb_flagsintr |= SB_SEL;
>               }
>       }
> +     sounlock(s);
>       return (revents);
>  }

Here you missed to convert sb_flagsintr |= SB_SEL to sb_flags.

And in filt_fifowdetach() is still a sb_flags &= ~SB_KNOTE.

bluhm

Reply via email to