Date: Mon, 3 Nov 2008 12:51:32 -0500 From: John Baldwin <jhb@freebsd.org> To: Robert Watson <rwatson@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r184568 - head/sys/netsmb Message-ID: <200811031251.32904.jhb@freebsd.org> In-Reply-To: <200811022022.mA2KMOCC047394@svn.freebsd.org> References: <200811022022.mA2KMOCC047394@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sunday 02 November 2008 03:22:24 pm Robert Watson wrote: > Author: rwatson > Date: Sun Nov 2 20:22:24 2008 > New Revision: 184568 > URL: http://svn.freebsd.org/changeset/base/184568 > > Log: > smb_vc_put() requires that the passed vcp be locked, so lock it before > dropping the connection when the requested service isn't available, or > we may try to release a lock that isn't locked. > > This prevents an assertion failure when trying to mount a non-present > share using smbfs with INVARIANTS; a lock order reversal warning that > immediately follows is not yet fixed. > > Reported by: attilio > MFC after: 3 days > > Modified: > head/sys/netsmb/smb_conn.c > > Modified: head/sys/netsmb/smb_conn.c > ============================================================================== > --- head/sys/netsmb/smb_conn.c Sun Nov 2 19:48:15 2008 (r184567) > +++ head/sys/netsmb/smb_conn.c Sun Nov 2 20:22:24 2008 (r184568) > @@ -218,8 +218,10 @@ out: > smb_sm_unlockvclist(td); > if (error == 0) > *vcpp = vcp; > - else if (vcp) > + else if (vcp) { > + smb_vc_lock(vcp, LK_EXCLUSIVE, scred->scr_td); > smb_vc_put(vcp, scred); > + } > return error; > } Can't you just do 'smb_vc_rele()' to avoid pointlessly acquiring the lock only to drop it again? Just as with vput/vrele for vnodes, smb_XX_rele() drops the reference count and smb_xx_put() is equivalent to 'smb_XX_rele() + lockmgr(LK_RELEASE)' -- John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200811031251.32904.jhb>