From owner-svn-src-head@freebsd.org Tue Jul 12 08:28:53 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 072BEB93175; Tue, 12 Jul 2016 08:28:53 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B19061642; Tue, 12 Jul 2016 08:28:52 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6C8SpDk025868; Tue, 12 Jul 2016 08:28:51 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6C8SpkK025866; Tue, 12 Jul 2016 08:28:51 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607120828.u6C8SpkK025866@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 12 Jul 2016 08:28:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302633 - in head/sys/dev/hyperv: include vmbus X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 08:28:53 -0000 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 #include #include +#include #include #include #include @@ -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