diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2010-09-07 19:27:52 +0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-09-07 19:31:54 +0400 |
commit | 7e443312403ad1ff40ef3177590e96d1fe747c79 (patch) | |
tree | 50a5428e88d62c5d02e045614fc31c05194d1be4 /drivers/scsi | |
parent | 0fb576d8251c10f498ed4c6938aeeed8d0c93cfe (diff) | |
download | linux-7e443312403ad1ff40ef3177590e96d1fe747c79.tar.xz |
[SCSI] sd: fix medium-removal bug
Commit 409f3499a2cfcd1e9c2857c53af7fcce069f027f (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>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/sd.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index cd71f46a3d47..ffa0689ee840 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -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); } |