svn commit: r184568 - head/sys/netsmb
John Baldwin
jhb at freebsd.org
Mon Nov 3 10:46:04 PST 2008
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
More information about the svn-src-head
mailing list