diff options
author | Martin K. Petersen <martin.petersen@oracle.com> | 2019-05-20 10:57:18 -0400 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2019-05-20 10:57:18 -0400 |
commit | 8acf608e602f6ec38b7cc37b04c80f1ce9a1a6cc (patch) | |
tree | 231add4abc463d299029c82bc4c2d9c54330085a | |
parent | d0c0d902339249c75da85fd9257a86cbb98dfaa5 (diff) |
Revert "scsi: sd: Keep disk read-only when re-reading partition"
This reverts commit 20bd1d026aacc5399464f8328f305985c493cde3.
This patch introduced regressions for devices that come online in
read-only state and subsequently switch to read-write.
Given how the partition code is currently implemented it is not
possible to persist the read-only flag across a device revalidate
call. This may need to get addressed in the future since it is common
for user applications to proactively call BLKRRPART.
Reverting this commit will re-introduce a regression where a
device-initiated revalidate event will cause the admin state to be
forgotten. A separate patch will address this issue.
Fixes: 20bd1d026aac ("scsi: sd: Keep disk read-only when re-reading partition")
Cc: <stable@vger.kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r-- | drivers/scsi/sd.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 2b2bc4b49d78..b894786df6c2 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -2603,7 +2603,6 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, unsigned char *buffer) | |||
2603 | int res; | 2603 | int res; |
2604 | struct scsi_device *sdp = sdkp->device; | 2604 | struct scsi_device *sdp = sdkp->device; |
2605 | struct scsi_mode_data data; | 2605 | struct scsi_mode_data data; |
2606 | int disk_ro = get_disk_ro(sdkp->disk); | ||
2607 | int old_wp = sdkp->write_prot; | 2606 | int old_wp = sdkp->write_prot; |
2608 | 2607 | ||
2609 | set_disk_ro(sdkp->disk, 0); | 2608 | set_disk_ro(sdkp->disk, 0); |
@@ -2644,7 +2643,7 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, unsigned char *buffer) | |||
2644 | "Test WP failed, assume Write Enabled\n"); | 2643 | "Test WP failed, assume Write Enabled\n"); |
2645 | } else { | 2644 | } else { |
2646 | sdkp->write_prot = ((data.device_specific & 0x80) != 0); | 2645 | sdkp->write_prot = ((data.device_specific & 0x80) != 0); |
2647 | set_disk_ro(sdkp->disk, sdkp->write_prot || disk_ro); | 2646 | set_disk_ro(sdkp->disk, sdkp->write_prot); |
2648 | if (sdkp->first_scan || old_wp != sdkp->write_prot) { | 2647 | if (sdkp->first_scan || old_wp != sdkp->write_prot) { |
2649 | sd_printk(KERN_NOTICE, sdkp, "Write Protect is %s\n", | 2648 | sd_printk(KERN_NOTICE, sdkp, "Write Protect is %s\n", |
2650 | sdkp->write_prot ? "on" : "off"); | 2649 | sdkp->write_prot ? "on" : "off"); |