Re: Spinup of SCSI Disks: allow_restart won't work on 2.6.18

Douglas Gilbert
2006-11-21T00:54:22Z

Stefan Richter wrote:
> Joern Quillman wrote:
>>>> One problem left. I still can't set or unset the flag with echo even
>>>> on 2.6.19-rc6 (as root).
> ...
>> Permissions of the file are -rw-r--r--. Owner is of course root.
>> As I wrote before I can set/unset the flag without any problems when I
>> connect a dumb USB<->IDE
>> converter with kernel 2.6.18. Same with 2.6.19-rc6.
>>
>> The complete error message (sorry it's in german here) is:
>> "-bash: echo: write error: Das Argument ist ungueltig"
>>
>> Is there a way to do some debug on the internals to see why the
>> attribute isn't actually writeable? Do you need parts of the kernel log?
>
> The responsible kernel code is drivers/scsi/sd.c::sd_store_allow_restart().
>
> static ssize_t sd_store_allow_restart(struct class_device *cdev, const
> char *buf,
> size_t count)
> {
> struct scsi_disk *sdkp = to_scsi_disk(cdev);
> struct scsi_device *sdp = sdkp->device;
>
> if (!capable(CAP_SYS_ADMIN))
> return -EACCES;
>
> if (sdp->type != TYPE_DISK)
> return -EINVAL;
>
> sdp->allow_restart = simple_strtoul(buf, NULL, 10);
>
> return count;
> }
>
>
> I think the solution is easy: Replace if (sdp->type != TYPE_DISK) by
>
> if (sdp->type != TYPE_DISK && sdp->type != TYPE_RBC)

... but why have the condition at all? What other peripheral
device type should the _sd_ driver be handling??

Doug Gilbert