linux-stable/drivers
Mohammed Gamal a56d99d714 hv_netvsc: Ensure correct teardown message sequence order
Prior to commit 0cf737808a ("hv_netvsc: netvsc_teardown_gpadl() split")
the call sequence in netvsc_device_remove() was as follows (as
implemented in netvsc_destroy_buf()):
1- Send NVSP_MSG1_TYPE_REVOKE_RECV_BUF message
2- Teardown receive buffer GPADL
3- Send NVSP_MSG1_TYPE_REVOKE_SEND_BUF message
4- Teardown send buffer GPADL
5- Close vmbus

This didn't work for WS2016 hosts. Commit 0cf737808a
("hv_netvsc: netvsc_teardown_gpadl() split") rearranged the
teardown sequence as follows:
1- Send NVSP_MSG1_TYPE_REVOKE_RECV_BUF message
2- Send NVSP_MSG1_TYPE_REVOKE_SEND_BUF message
3- Close vmbus
4- Teardown receive buffer GPADL
5- Teardown send buffer GPADL

That worked well for WS2016 hosts, but it prevented guests on older hosts from
shutting down after changing network settings. Commit 0ef58b0a05
("hv_netvsc: change GPAD teardown order on older versions") ensured the
following message sequence for older hosts
1- Send NVSP_MSG1_TYPE_REVOKE_RECV_BUF message
2- Send NVSP_MSG1_TYPE_REVOKE_SEND_BUF message
3- Teardown receive buffer GPADL
4- Teardown send buffer GPADL
5- Close vmbus

However, with this sequence calling `ip link set eth0 mtu 1000` hangs and the
process becomes uninterruptible. On futher analysis it turns out that on tearing
down the receive buffer GPADL the kernel is waiting indefinitely
in vmbus_teardown_gpadl() for a completion to be signaled.

Here is a snippet of where this occurs:
int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle)
{
        struct vmbus_channel_gpadl_teardown *msg;
        struct vmbus_channel_msginfo *info;
        unsigned long flags;
        int ret;

        info = kmalloc(sizeof(*info) +
                       sizeof(struct vmbus_channel_gpadl_teardown), GFP_KERNEL);
        if (!info)
                return -ENOMEM;

        init_completion(&info->waitevent);
        info->waiting_channel = channel;
[....]
        ret = vmbus_post_msg(msg, sizeof(struct vmbus_channel_gpadl_teardown),
                             true);

        if (ret)
                goto post_msg_err;

        wait_for_completion(&info->waitevent);
[....]
}

The completion is signaled from vmbus_ongpadl_torndown(), which gets called when
the corresponding message is received from the host, which apparently never happens
in that case.
This patch works around the issue by restoring the first mentioned message sequence
for older hosts

Fixes: 0ef58b0a05 ("hv_netvsc: change GPAD teardown order on older versions")
Signed-off-by: Mohammed Gamal <mgamal@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-04-05 22:21:00 -04:00
..
accessibility
acpi arm64 updates for 4.17 2018-04-04 16:01:43 -07:00
amba
android
ata Merge branch 'for-4.17' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata 2018-04-03 17:42:25 -07:00
atm Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2018-04-01 19:49:34 -04:00
auxdisplay
base Driver core patches for 4.17-rc1 2018-04-04 19:41:45 -07:00
bcma
block
bluetooth Bluetooth: Set HCI_QUIRK_SIMULTANEOUS_DISCOVERY for BTUSB_QCA_ROME 2018-04-01 21:43:02 +03:00
bus Staging/IIO patches for 4.17-rc1 2018-04-04 18:56:27 -07:00
cdrom
char Char/Misc patches for 4.17-rc1 2018-04-04 20:07:20 -07:00
clk
clocksource arch: remove obsolete architecture ports 2018-04-02 20:20:12 -07:00
connector
cpufreq Power management updates for 4.17-rc1 2018-04-03 10:45:39 -07:00
cpuidle cpuidle: poll_state: Avoid invoking local_clock() too often 2018-03-29 13:06:08 +02:00
crypto Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2018-04-04 17:11:08 -07:00
dax
dca
devfreq
dio
dma
dma-buf
edac arch: remove obsolete architecture ports 2018-04-02 20:20:12 -07:00
eisa
extcon Char/Misc patches for 4.17-rc1 2018-04-04 20:07:20 -07:00
firewire
firmware Merge branch 'efi-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2018-04-02 17:46:37 -07:00
fmc
fpga
fsi
gpio arch: remove obsolete architecture ports 2018-04-02 20:20:12 -07:00
gpu Char/Misc patches for 4.17-rc1 2018-04-04 20:07:20 -07:00
hid
hsi
hv
hwmon
hwspinlock
hwtracing Char/Misc patches for 4.17-rc1 2018-04-04 20:07:20 -07:00
i2c arch: remove obsolete architecture ports 2018-04-02 20:20:12 -07:00
ide LED updates for 4.17-rc1 2018-04-03 12:38:19 -07:00
idle
iio
infiniband Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2018-04-01 19:49:34 -04:00
input Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2018-04-04 14:50:29 -07:00
iommu Merge branch 'x86-dma-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2018-04-02 17:18:45 -07:00
ipack
irqchip Staging/IIO patches for 4.17-rc1 2018-04-04 18:56:27 -07:00
isdn Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2018-04-03 14:04:18 -07:00
leds
lightnvm
macintosh
mailbox
mcb
md dm: fix dropped return code from dm_get_bdev_for_ioctl 2018-03-29 23:31:32 -04:00
media media updates for v4.17-rc1 2018-04-03 17:16:59 -07:00
memory
memstick
message
mfd
misc Char/Misc patches for 4.17-rc1 2018-04-04 20:07:20 -07:00
mmc MMC core: 2018-04-03 12:17:25 -07:00
mtd mtd: jedec_probe: Fix crash in jedec_read_mfr() 2018-03-29 19:29:06 +02:00
mux
net hv_netvsc: Ensure correct teardown message sequence order 2018-04-05 22:21:00 -04:00
nfc
ntb
nubus
nvdimm
nvme
nvmem Char/Misc patches for 4.17-rc1 2018-04-04 20:07:20 -07:00
of Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2018-04-03 14:04:18 -07:00
opp
oprofile oprofilefs: don't oops on allocation failure 2018-03-29 15:07:48 -04:00
parisc
parport Char/Misc patches for 4.17-rc1 2018-04-04 20:07:20 -07:00
pci arch: remove obsolete architecture ports 2018-04-02 20:20:12 -07:00
pcmcia Power management updates for 4.17-rc1 2018-04-03 10:45:39 -07:00
perf arm64 updates for 4.17 2018-04-04 16:01:43 -07:00
phy
pinctrl Pin control bulk changes for the v4.17 kernel cycle: 2018-04-03 12:20:54 -07:00
platform USB/PHY patches for 4.17-rc1 2018-04-04 17:55:35 -07:00
pnp
power power supply and reset changes for the v4.17 series 2018-04-03 12:10:01 -07:00
powercap
pps
ps3
ptp
pwm
rapidio
ras
regulator
remoteproc
reset
rpmsg
rtc
s390 Kbuild updates for v4.17 2018-04-03 15:51:22 -07:00
sbus sparc64: Properly range check DAX completion index 2018-04-01 20:07:00 -04:00
scsi Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2018-04-01 19:49:34 -04:00
sfi
sh
siox
slimbus
sn
soc
soundwire
spi spi: SPI updates for v4.17 2018-04-03 12:06:21 -07:00
spmi
ssb
staging Staging/IIO patches for 4.17-rc1 2018-04-04 18:56:27 -07:00
target
tc
tee
thermal
thunderbolt
tty TTY/Serial driver patches for 4.17-rc1 2018-04-04 18:43:49 -07:00
uio
usb TTY/Serial driver patches for 4.17-rc1 2018-04-04 18:43:49 -07:00
uwb
vfio
vhost Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2018-04-01 19:49:34 -04:00
video TTY/Serial driver patches for 4.17-rc1 2018-04-04 18:43:49 -07:00
virt
virtio
visorbus
vlynq
vme
w1
watchdog arch: remove obsolete architecture ports 2018-04-02 20:20:12 -07:00
xen
zorro
Kconfig hwtracing: Add HW tracing support menu 2018-03-29 13:38:10 +03:00
Makefile