From: Dan Duval Date: Mon, 8 Feb 2016 22:03:32 +0000 (-0500) Subject: Revert "scsi: Fix a bdi reregistration race" X-Git-Tag: v4.1.12-92~189^2~430 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=bb5a331b5ff8149275002001afcf7f6c4e43824f;p=users%2Fjedix%2Flinux-maple.git Revert "scsi: Fix a bdi reregistration race" Orabug: 22679087 (this revert is commit e619e6cbecb7fe97a924d625e848605333457b13 upstream) This reverts commit c8f01671e9a91837fc2b6be625f915977e786447. The SCSI sd driver probes SCSI devices asynchronously. The sd_remove() function, called indirectly by device_del(), waits until asynchronous probing has finished. Since the block layer queue must only be cleaned up after probing has finished, device_del() has to be called before blk_cleanup_queue(). Hence revert commit bf2cf3b. Signed-off-by: Bart Van Assche Cc: Signed-off-by: James Bottomley Signed-off-by: Dan Duval --- diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index 585453faf1f37..9ad41168d26df 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c @@ -1074,7 +1074,9 @@ void __scsi_remove_device(struct scsi_device *sdev) bsg_unregister_queue(sdev->request_queue); device_unregister(&sdev->sdev_dev); transport_remove_device(dev); - } + device_del(dev); + } else + put_device(&sdev->sdev_dev); /* * Stop accepting new requests and wait until all queuecommand() and @@ -1085,16 +1087,6 @@ void __scsi_remove_device(struct scsi_device *sdev) blk_cleanup_queue(sdev->request_queue); cancel_work_sync(&sdev->requeue_work); - /* - * Remove the device after blk_cleanup_queue() has been called such - * a possible bdi_register() call with the same name occurs after - * blk_cleanup_queue() has called bdi_destroy(). - */ - if (sdev->is_visible) - device_del(dev); - else - put_device(&sdev->sdev_dev); - if (sdev->host->hostt->slave_destroy) sdev->host->hostt->slave_destroy(sdev); transport_destroy_device(dev);