Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

Pull SCSI fixes from James Bottomley:
"Two small fixes, both in upper layer drivers (scsi disk and cdrom).

The sd one is fixing a commit changing revalidation that came from the
block tree a while ago (5.10) and the sr one adds handling of a
condition we didn't previously handle for manually removed media"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
scsi: sd: Call sd_revalidate_disk() for ioctl(BLKRRPART)
scsi: sr: Return appropriate error code when disk is ejected

+20 -4
+18 -4
drivers/scsi/sd.c
··· 1387 1387 } 1388 1388 } 1389 1389 1390 + static bool sd_need_revalidate(struct block_device *bdev, 1391 + struct scsi_disk *sdkp) 1392 + { 1393 + if (sdkp->device->removable || sdkp->write_prot) { 1394 + if (bdev_check_media_change(bdev)) 1395 + return true; 1396 + } 1397 + 1398 + /* 1399 + * Force a full rescan after ioctl(BLKRRPART). While the disk state has 1400 + * nothing to do with partitions, BLKRRPART is used to force a full 1401 + * revalidate after things like a format for historical reasons. 1402 + */ 1403 + return test_bit(GD_NEED_PART_SCAN, &bdev->bd_disk->state); 1404 + } 1405 + 1390 1406 /** 1391 1407 * sd_open - open a scsi disk device 1392 1408 * @bdev: Block device of the scsi disk to open ··· 1439 1423 if (!scsi_block_when_processing_errors(sdev)) 1440 1424 goto error_out; 1441 1425 1442 - if (sdev->removable || sdkp->write_prot) { 1443 - if (bdev_check_media_change(bdev)) 1444 - sd_revalidate_disk(bdev->bd_disk); 1445 - } 1426 + if (sd_need_revalidate(bdev, sdkp)) 1427 + sd_revalidate_disk(bdev->bd_disk); 1446 1428 1447 1429 /* 1448 1430 * If the drive is empty, just let the open fail.
+2
drivers/scsi/sr.c
··· 220 220 return DISK_EVENT_EJECT_REQUEST; 221 221 else if (med->media_event_code == 2) 222 222 return DISK_EVENT_MEDIA_CHANGE; 223 + else if (med->media_event_code == 3) 224 + return DISK_EVENT_EJECT_REQUEST; 223 225 return 0; 224 226 } 225 227