[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>

authored by Alan Stern and committed by James Bottomley 7e443312 0fb576d8

+1 -1
+1 -1
drivers/scsi/sd.c
··· 870 871 SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp, "sd_release\n")); 872 873 - if (atomic_dec_return(&sdkp->openers) && sdev->removable) { 874 if (scsi_block_when_processing_errors(sdev)) 875 scsi_set_medium_removal(sdev, SCSI_REMOVAL_ALLOW); 876 }
··· 870 871 SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp, "sd_release\n")); 872 873 + if (atomic_dec_return(&sdkp->openers) == 0 && sdev->removable) { 874 if (scsi_block_when_processing_errors(sdev)) 875 scsi_set_medium_removal(sdev, SCSI_REMOVAL_ALLOW); 876 }