Date: Fri, 25 Nov 2016 06:12:18 +0000 (UTC) From: Sepherosa Ziehau <sephe@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r309132 - head/sys/dev/hyperv/vmbus Message-ID: <201611250612.uAP6CISX058184@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: sephe Date: Fri Nov 25 06:12:18 2016 New Revision: 309132 URL: https://svnweb.freebsd.org/changeset/base/309132 Log: hyperv/vmbus: Don't close unopened channels. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8566 Modified: head/sys/dev/hyperv/vmbus/vmbus_chan.c Modified: head/sys/dev/hyperv/vmbus/vmbus_chan.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_chan.c Fri Nov 25 06:01:45 2016 (r309131) +++ head/sys/dev/hyperv/vmbus/vmbus_chan.c Fri Nov 25 06:12:18 2016 (r309132) @@ -688,10 +688,28 @@ vmbus_chan_close_internal(struct vmbus_c struct vmbus_softc *sc = chan->ch_vmbus; struct vmbus_msghc *mh; struct vmbus_chanmsg_chclose *req; + uint32_t old_stflags; int error; - /* TODO: stringent check */ - atomic_clear_int(&chan->ch_stflags, VMBUS_CHAN_ST_OPENED); + /* + * NOTE: + * Sub-channels are closed upon their primary channel closing, + * so they can be closed even before they are opened. + */ + for (;;) { + old_stflags = chan->ch_stflags; + if (atomic_cmpset_int(&chan->ch_stflags, old_stflags, + old_stflags & ~VMBUS_CHAN_ST_OPENED)) + break; + } + if ((old_stflags & VMBUS_CHAN_ST_OPENED) == 0) { + /* Not opened yet; done */ + if (bootverbose) { + vmbus_chan_printf(chan, "chan%u not opened\n", + chan->ch_id); + } + return; + } /* * Free this channel's sysctl tree attached to its device's
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201611250612.uAP6CISX058184>