On Sat, Aug 06, 2022 at 12:19:45AM +0200, Alexander Bluhm wrote:
> On Sat, Aug 06, 2022 at 01:07:31AM +0300, Vitaliy Makkoveev wrote:
> > I thought you will introduce something like below. This does the
> > same but it has no heuristic under the hood.
> > 
> > int
> > sbwait_shared(struct socket *so, struct sockbuf *sb)
> > {       
> >         int error;
> >         
> >         if (so->so_proto->pr_unlock != NULL)
> >                 (*so->so_proto->pr_unlock)(so);
> >         error = sbwait(so, sb);
> >         if (so->so_proto->pr_lock != NULL)
> >                 (*so->so_proto->pr_lock)(so);
> > 
> >         return error;
> > }
> 
> sbwait() needs the mutex for sb->sb_flags |= SB_WAIT.
> 
> sblock() also has to release the mutex while sleeping.
> My sosleep_nsec() does that.
> 
> Better ideas are welcome.  Maybe some day sosleep_nsec() will always
> have a shared net lock.
> 
> bluhm

Sorry for my yesterday idiotia.

I'm not very happy with rw_status(9) magic under the sosleep_nsec()
hood. But I don't think the `shared' arg for sbwait()/sblock() and
sosleep_nsec() is better solution. We also could make something like
_sbwait(..., shared) and use sbwait() and sbwait_shared() wrappers
but I also don't think this is good enough.

This diff is ok by me. Feel free to commit it with newly introduced
NET_LOCK_SHARED() macros unless nobody has objections. 

Reply via email to