Hi James, when accessing a device with disabled read access the capacity is set somewhat arbitrary to 1GB. This makes it quite impossible for userspace applications to detect this as an invalid capacity. And it is inconsistent with other error conditions, where the capacity is in fact set to 0. Please apply. Cheers, Hannes -- Dr. Hannes Reinecke hare@xxxxxxx SuSE Linux Products GmbH S390 & zSeries Maxfeldstraße 5 +49 911 74053 688 90409 Nürnberg http://www.suse.de
Wrong size information for devices with disabled read access When accessing a device with disabled read access the capacity is set randomly to 1GB. This makes it impossible to userspace tools to detect invalid device capacities. Signed-off-by: Mike Anderson <andmike@xxxxxxxxxx> Acked-by: Chris Mason <mason@xxxxxxxx> Signed-off-by: Hannes Reinecke <hare@xxxxxxx> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 98bd3aa..638cff4 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1215,7 +1215,7 @@ repeat: /* Either no media are present but the drive didn't tell us, or they are present but the read capacity command fails */ /* sdkp->media_present = 0; -- not always correct */ - sdkp->capacity = 0x200000; /* 1 GB - random */ + sdkp->capacity = 0; /* unknown mapped to zero - as usual */ return; } else if (the_result && longrc) {