> From: Li,Rongqing <lirongqing@xxxxxxxxx> > Sent: Thursday, January 11, 2024 2:45 PM > > Revert "virtio_pci: Support surprise removal of virtio pci device" > > This reverts commit 43bb40c5b92659966bdf4bfe584fde0a3575a049. > > Marking the device as broken will cause the uncompleted IO request on > virtio-blk since virtblk_done will not continue when it find the broken > virtqueu at last it will cause the failure of removal of virtio-blk device because > of uncompleted IO request > > The correct fix for the issue that commit 43bb40c5b9 ("virtio_pci: > Support surprise removal of virtio pci device") tried to fix is that virtio > backend always complete the IO request as soon as possible > This can never be guaranteed by a device and by pci spec given it is surprise removal by definition. For Linux virtio blk is not the only block device which has surprised removal. Nvme blk driver has supported surprise removal for several years now. I am sure nbd and others would have too given its network. I am not familiar with the blk driver stack. So please explore with blk community of how to complete an aborted/never completed io which never completed by the device. Since the blk driver knows exactly that the device is removed, it can 100% complete the io to upper layer with the error in deterministic way. > Signed-off-by: Li RongQing <lirongqing@xxxxxxxxx> > --- > drivers/virtio/virtio_pci_common.c | 7 ------- > 1 file changed, 7 deletions(-) > > diff --git a/drivers/virtio/virtio_pci_common.c > b/drivers/virtio/virtio_pci_common.c > index 7a55939..d60fe99 100644 > --- a/drivers/virtio/virtio_pci_common.c > +++ b/drivers/virtio/virtio_pci_common.c > @@ -584,13 +584,6 @@ static void virtio_pci_remove(struct pci_dev > *pci_dev) > struct virtio_pci_device *vp_dev = pci_get_drvdata(pci_dev); > struct device *dev = get_device(&vp_dev->vdev.dev); > > - /* > - * Device is marked broken on surprise removal so that virtio upper > - * layers can abort any ongoing operation. > - */ > - if (!pci_device_is_present(pci_dev)) > - virtio_break_device(&vp_dev->vdev); > - > pci_disable_sriov(pci_dev); > > unregister_virtio_device(&vp_dev->vdev); > -- > 2.9.4