On Thu, Feb 09, 2017 at 12:36:44PM +0100, Martin Pieuchot wrote: > [0] https://marc.info/?l=openbsd-misc&m=148661605114230&w=2
My test shows that unix doamin socket on NFS file system works. > void > sofree(struct socket *so) > { > - NET_ASSERT_LOCKED(); > - Could you keep an SOCKET_ASSERT_LOCKED(so) here? > @@ -232,7 +230,7 @@ soclose(struct socket *so) > struct socket *so2; > int s, error = 0; > > - NET_LOCK(s); > + SOCKET_LOCK(so, s); > if (so->so_options & SO_ACCEPTCONN) { > while ((so2 = TAILQ_FIRST(&so->so_q0)) != NULL) { > (void) soqremque(so2, 0); Here comes the call to soabort(so2). int soabort(struct socket *so) { NET_ASSERT_LOCKED(); So this must be an SOCKET_ASSERT_LOCKED(so). splassert: soabort: want 64 have 0 Starting stack trace... splassert_check(40,0,d09e5ddb,d09d5adf,d03cfed0) at splassert_check+0x78 splassert_check(40,d09e5ddb,d09e5ddb,d03cabb2,d97d2e68) at splassert_check+0x78 soabort(d9553484,1,0,0,0) at soabort+0x5c soclose(d9553ba4,0,2f39005a,d97d2e60,0) at soclose+0x188 soo_close(d97d20a0,d95c7ea0,2f39005a,0,0) at soo_close+0x1b fdrop(d97d20a0,d95c7ea0,f5786edc,d03a29df,d954472c) at fdrop+0x28 closef(d97d20a0,d95c7ea0,f5786f0c,d03a93e2,d0bca2c0) at closef+0xcc sys_close(d95c7ea0,f5786f5c,f5786f7c,0,f5786fa8) at sys_close+0x5a syscall() at syscall+0x250 > @@ -121,6 +121,9 @@ uipc_usrreq(struct socket *so, int req, > error = EINVAL; > goto release; > } > + > + NET_ASSERT_UNLOCKED(); > + > switch (req) { ... > case PRU_BIND: > - /* XXXSMP breaks atomicity */ > - rw_exit_write(&netlock); > + NET_ASSERT_UNLOCKED(); Do not assert twice. > unp_detach(struct unpcb *unp) > { > struct vnode *vp; > - > - NET_ASSERT_UNLOCKED(); > - > + There is a tab after the + > @@ -539,7 +526,7 @@ unp_connect(struct socket *so, struct mb > error = EPROTOTYPE; > goto bad; > } > - NET_LOCK(s); > + SOCKET_LOCK(so, s); > if (so->so_proto->pr_flags & PR_CONNREQUIRED) { > if ((so2->so_options & SO_ACCEPTCONN) == 0 || > (so3 = sonewconn(so2, 0)) == 0) { > @@ -564,7 +551,7 @@ unp_connect(struct socket *so, struct mb > } > error = unp_connect2(so, so2); > unlock: > - NET_UNLOCK(s); > + SOCKET_UNLOCK(s); > bad: The socket sould be a PF_LOCAL anyway, so SOCKET_LOCK() and SOCKET_UNLOCK() do nothing. Remove these lines. > +#define SOCKET_LOCK(so, s) \ > +do { \ > + if (so->so_proto->pr_domain->dom_family != PF_LOCAL) \ > + NET_LOCK(s); \ > + else \ > + s = -42; \ > +} while (0) > + > +#define SOCKET_UNLOCK(s) > \ > +do { \ > + if (s != -42) \ > + NET_UNLOCK(s); \ > +} while (0) The 42 looks like an evil hack. bluhm