> From: Stephen Hemminger <step...@networkplumber.org> > Sent: Friday, December 7, 2018 10:59 AM > To: KY Srinivasan <k...@microsoft.com>; Haiyang Zhang > <haiya...@microsoft.com>; Dexuan Cui <de...@microsoft.com>; > mga...@redhat.com > Cc: de...@linuxdriverproject.org; Stephen Hemminger > <sthem...@microsoft.com> > Subject: [PATCH] vmbus: fix subchannel removal > > The changes to split ring allocation from open/close, broke > the cleanup of subchannels. This resulted in problems using > uio on network devices because the subchannel was left behind > when the network device was unbound. > > The cause was in the disconnect logic which used list splice > to move the subchannel list into a local variable. This won't > work because the subchannel list is needed later during the > process of the rescind messages (relid2channel). > > The fix is to just leave the subchannel list in place > which is what the original code did. The list is cleaned > up later when the host rescind is processed. > > Fixes: ae6935ed7d42 ("vmbus: split ring buffer allocation from open") > Signed-off-by: Stephen Hemminger <sthem...@microsoft.com> > --- > drivers/hv/channel.c | 10 +--------- > 1 file changed, 1 insertion(+), 9 deletions(-) > > diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c > index fe00b12e4417..bea4c9850247 100644 > --- a/drivers/hv/channel.c > +++ b/drivers/hv/channel.c > @@ -701,20 +701,12 @@ static int vmbus_close_internal(struct > vmbus_channel *channel) > int vmbus_disconnect_ring(struct vmbus_channel *channel) > { > struct vmbus_channel *cur_channel, *tmp; > - unsigned long flags; > - LIST_HEAD(list); > int ret; > > if (channel->primary_channel != NULL) > return -EINVAL; > > - /* Snapshot the list of subchannels */ > - spin_lock_irqsave(&channel->lock, flags); > - list_splice_init(&channel->sc_list, &list); > - channel->num_sc = 0; > - spin_unlock_irqrestore(&channel->lock, flags); > - > - list_for_each_entry_safe(cur_channel, tmp, &list, sc_list) { > + list_for_each_entry_safe(cur_channel, tmp, &channel->sc_list, sc_list) { > if (cur_channel->rescind) > wait_for_completion(&cur_channel->rescind_event); >
Reviewed-by: Dexuan Cui <de...@microsoft.com> 4.20-rc6 is out now. I hope this fix still has a chance to go in v4.20-final. Thanks, -- Dexuan _______________________________________________ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel