Skip to content

Commit

Permalink
[SCSI] sd: fix medium-removal bug
Browse files Browse the repository at this point in the history
Commit 409f349 (scsi/sd: remove big
kernel lock) introduced a bug in the sd_release routine.  Medium
removal should be allowed when the number of open file references
drops to 0, not when it becomes non-zero.

This patch (as1414) adjusts the test to fix the bug.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
  • Loading branch information
Alan Stern authored and James Bottomley committed Sep 7, 2010
1 parent 0fb576d commit 7e44331
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/scsi/sd.c
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ static int sd_release(struct gendisk *disk, fmode_t mode)

SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp, "sd_release\n"));

if (atomic_dec_return(&sdkp->openers) && sdev->removable) {
if (atomic_dec_return(&sdkp->openers) == 0 && sdev->removable) {
if (scsi_block_when_processing_errors(sdev))
scsi_set_medium_removal(sdev, SCSI_REMOVAL_ALLOW);
}
Expand Down

0 comments on commit 7e44331

Please sign in to comment.