svn commit: r302633 - in head/sys/dev/hyperv: include vmbus

Sepherosa Ziehau sephe at FreeBSD.org
Tue Jul 12 08:28:53 UTC 2016


Author: sephe
Date: Tue Jul 12 08:28:51 2016
New Revision: 302633
URL: https://svnweb.freebsd.org/changeset/base/302633

Log:
  hyperv/vmbus: Free sysctl properly upon channel close.
  
  Prepare for sub-channel re-open.
  
  MFC after:	1 week
  Sponsored by:	Microsoft OSTC
  Differential Revision:	https://reviews.freebsd.org/D6977

Modified:
  head/sys/dev/hyperv/include/hyperv.h
  head/sys/dev/hyperv/vmbus/hv_channel.c

Modified: head/sys/dev/hyperv/include/hyperv.h
==============================================================================
--- head/sys/dev/hyperv/include/hyperv.h	Tue Jul 12 08:21:28 2016	(r302632)
+++ head/sys/dev/hyperv/include/hyperv.h	Tue Jul 12 08:28:51 2016	(r302633)
@@ -49,6 +49,7 @@
 #include <sys/smp.h>
 #include <sys/mutex.h>
 #include <sys/bus.h>
+#include <sys/sysctl.h>
 #include <vm/vm.h>
 #include <vm/vm_param.h>
 #include <vm/pmap.h>
@@ -627,6 +628,8 @@ typedef struct hv_vmbus_channel {
 
 	struct task			ch_detach_task;
 	TAILQ_ENTRY(hv_vmbus_channel)	ch_link;
+
+	struct sysctl_ctx_list		ch_sysctl_ctx;
 } hv_vmbus_channel;
 
 #define HV_VMBUS_CHAN_ISPRIMARY(chan)	((chan)->primary_channel == NULL)

Modified: head/sys/dev/hyperv/vmbus/hv_channel.c
==============================================================================
--- head/sys/dev/hyperv/vmbus/hv_channel.c	Tue Jul 12 08:21:28 2016	(r302632)
+++ head/sys/dev/hyperv/vmbus/hv_channel.c	Tue Jul 12 08:28:51 2016	(r302633)
@@ -111,7 +111,8 @@ vmbus_channel_sysctl_create(hv_vmbus_cha
 		ch_id = primary_ch->offer_msg.child_rel_id;
 		sub_ch_id = channel->offer_msg.offer.sub_channel_index;
 	}
-	ctx = device_get_sysctl_ctx(dev);
+	ctx = &channel->ch_sysctl_ctx;
+	sysctl_ctx_init(ctx);
 	/* This creates dev.DEVNAME.DEVUNIT.channel tree */
 	devch_sysctl = SYSCTL_ADD_NODE(ctx,
 		    SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
@@ -482,6 +483,7 @@ hv_vmbus_channel_close_internal(hv_vmbus
 	int error;
 
 	channel->state = HV_CHANNEL_OPEN_STATE;
+	sysctl_ctx_free(&channel->ch_sysctl_ctx);
 
 	/*
 	 * set rxq to NULL to avoid more requests be scheduled


More information about the svn-src-head mailing list