freebsd-dev/sys/rpc
Rick Macklem 2ba476324b Both a crash reported on freebsd-current on Oct. 18 under the
subject heading "mtx_lock() of destroyed mutex on NFS" and
PR# 156168 appear to be caused by clnt_dg_destroy() closing
down the socket prematurely. When to close down the socket
is controlled by a reference count (cs_refs), but clnt_dg_create()
checks for sb_upcall being non-NULL to decide if a new socket
is needed. I believe the crashes were caused by the following race:
  clnt_dg_destroy() finds cs_refs == 0 and decides to delete socket
  clnt_dg_destroy() then loses race with clnt_dg_create() for
    acquisition of the SOCKBUF_LOCK()
  clnt_dg_create() finds sb_upcall != NULL and increments cs_refs to 1
  clnt_dg_destroy() then acquires SOCKBUF_LOCK(), sets sb_upcall to
    NULL and destroys socket

This patch fixes the above race by changing clnt_dg_destroy() so
that it acquires SOCKBUF_LOCK() before testing cs_refs.

Tested by:	bz
PR:		156168
Reviewed by:	dfr
MFC after:	2 weeks
2011-11-03 14:38:03 +00:00
..
rpcsec_gss Remove an extraneous "already" from a comment introduced by r226081. 2011-10-07 13:16:21 +00:00
auth_none.c
auth_unix.c
auth.h
authunix_prot.c Replace the static NGROUPS=NGROUPS_MAX+1=1024 with a dynamic 2010-01-12 07:49:34 +00:00
clnt_dg.c Both a crash reported on freebsd-current on Oct. 18 under the 2011-11-03 14:38:03 +00:00
clnt_rc.c This patch is believed to fix a problem in the kernel rpc for 2011-04-27 18:19:26 +00:00
clnt_stat.h
clnt_vc.c This patch is believed to fix a problem in the kernel rpc for 2011-04-27 18:19:26 +00:00
clnt.h This patch is believed to fix a problem in the kernel rpc for 2011-04-27 18:19:26 +00:00
getnetconfig.c
netconfig.h
nettype.h
pmap_prot.h
replay.c - Check the result of malloc(M_NOWAIT) in replay_alloc(). The caller 2010-08-26 23:33:04 +00:00
replay.h
rpc_callmsg.c
rpc_com.h Make the RPC specific __rpc_inet_ntop() and __rpc_inet_pton() general 2010-09-24 15:01:45 +00:00
rpc_generic.c Fix the kgssapi so that it can be loaded as a module. Currently 2011-06-19 22:08:55 +00:00
rpc_msg.h
rpc_prot.c
rpc.h
rpcb_clnt.c This patch is believed to fix a problem in the kernel rpc for 2011-04-27 18:19:26 +00:00
rpcb_clnt.h
rpcb_prot.c
rpcb_prot.h
rpcm_subs.h
rpcsec_gss.h Fix the kgssapi so that it can be loaded as a module. Currently 2011-06-19 22:08:55 +00:00
svc_auth_unix.c
svc_auth.c
svc_auth.h
svc_dg.c Mfp4 CH=177274,177280,177284-177285,177297,177324-177325 2011-02-16 21:29:13 +00:00
svc_generic.c Mfp4 CH=177274,177280,177284-177285,177297,177324-177325 2011-02-16 21:29:13 +00:00
svc_vc.c Mfp4 CH=177274,177280,177284-177285,177297,177324-177325 2011-02-16 21:29:13 +00:00
svc.c sysctl(9) cleanup checkpoint: amd64 GENERIC builds cleanly. 2011-01-12 19:54:19 +00:00
svc.h
types.h
xdr.h