diff options
Diffstat (limited to 'drivers/scsi/sd.c')
-rw-r--r-- | drivers/scsi/sd.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 633ac32b25c1..01680c7c8507 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -795,6 +795,7 @@ static int sd_open(struct block_device *bdev, fmode_t mode) | |||
795 | 795 | ||
796 | SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp, "sd_open\n")); | 796 | SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp, "sd_open\n")); |
797 | 797 | ||
798 | lock_kernel(); | ||
798 | sdev = sdkp->device; | 799 | sdev = sdkp->device; |
799 | 800 | ||
800 | /* | 801 | /* |
@@ -838,10 +839,12 @@ static int sd_open(struct block_device *bdev, fmode_t mode) | |||
838 | scsi_set_medium_removal(sdev, SCSI_REMOVAL_PREVENT); | 839 | scsi_set_medium_removal(sdev, SCSI_REMOVAL_PREVENT); |
839 | } | 840 | } |
840 | 841 | ||
842 | unlock_kernel(); | ||
841 | return 0; | 843 | return 0; |
842 | 844 | ||
843 | error_out: | 845 | error_out: |
844 | scsi_disk_put(sdkp); | 846 | scsi_disk_put(sdkp); |
847 | unlock_kernel(); | ||
845 | return retval; | 848 | return retval; |
846 | } | 849 | } |
847 | 850 | ||
@@ -863,6 +866,7 @@ static int sd_release(struct gendisk *disk, fmode_t mode) | |||
863 | 866 | ||
864 | SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp, "sd_release\n")); | 867 | SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp, "sd_release\n")); |
865 | 868 | ||
869 | lock_kernel(); | ||
866 | if (!--sdkp->openers && sdev->removable) { | 870 | if (!--sdkp->openers && sdev->removable) { |
867 | if (scsi_block_when_processing_errors(sdev)) | 871 | if (scsi_block_when_processing_errors(sdev)) |
868 | scsi_set_medium_removal(sdev, SCSI_REMOVAL_ALLOW); | 872 | scsi_set_medium_removal(sdev, SCSI_REMOVAL_ALLOW); |
@@ -873,6 +877,7 @@ static int sd_release(struct gendisk *disk, fmode_t mode) | |||
873 | * XXX is followed by a "rmmod sd_mod"? | 877 | * XXX is followed by a "rmmod sd_mod"? |
874 | */ | 878 | */ |
875 | scsi_disk_put(sdkp); | 879 | scsi_disk_put(sdkp); |
880 | unlock_kernel(); | ||
876 | return 0; | 881 | return 0; |
877 | } | 882 | } |
878 | 883 | ||