Skip to content

Commit e619e6c

Browse files
Bart Van AsscheJames Bottomley
authored andcommitted
Revert "scsi: Fix a bdi reregistration race"
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>
1 parent 8005c49 commit e619e6c

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

drivers/scsi/scsi_sysfs.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,7 +1110,9 @@ void __scsi_remove_device(struct scsi_device *sdev)
11101110
device_unregister(&sdev->sdev_dev);
11111111
transport_remove_device(dev);
11121112
scsi_dh_remove_device(sdev);
1113-
}
1113+
device_del(dev);
1114+
} else
1115+
put_device(&sdev->sdev_dev);
11141116

11151117
/*
11161118
* Stop accepting new requests and wait until all queuecommand() and
@@ -1121,16 +1123,6 @@ void __scsi_remove_device(struct scsi_device *sdev)
11211123
blk_cleanup_queue(sdev->request_queue);
11221124
cancel_work_sync(&sdev->requeue_work);
11231125

1124-
/*
1125-
* Remove the device after blk_cleanup_queue() has been called such
1126-
* a possible bdi_register() call with the same name occurs after
1127-
* blk_cleanup_queue() has called bdi_destroy().
1128-
*/
1129-
if (sdev->is_visible)
1130-
device_del(dev);
1131-
else
1132-
put_device(&sdev->sdev_dev);
1133-
11341126
if (sdev->host->hostt->slave_destroy)
11351127
sdev->host->hostt->slave_destroy(sdev);
11361128
transport_destroy_device(dev);

0 commit comments

Comments
 (0)