]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
Revert "scsi: Fix a bdi reregistration race"
authorDan Duval <dan.duval@oracle.com>
Mon, 8 Feb 2016 22:03:32 +0000 (17:03 -0500)
committerChuck Anderson <chuck.anderson@oracle.com>
Thu, 10 Mar 2016 15:06:45 +0000 (07:06 -0800)
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 <bart.vanassche@sandisk.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
Signed-off-by: Dan Duval <dan.duval@oracle.com>
drivers/scsi/scsi_sysfs.c

index 585453faf1f37bda317d91a3cc6e50a5c92a3778..9ad41168d26df1897814121766cd2e8fbd3a0243 100644 (file)
@@ -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);