Re: [PATCH] scsi: sd: Keep disk read-only when re-reading partition

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 1, 2018 at 4:08 PM, Jeremy Cline <jeremy@xxxxxxxxxx> wrote:
> If the read-only flag is true on a SCSI disk, re-reading the partition
> table sets the flag back to false.
>
> To observe this bug, you can run:
>
> 1. blockdev --setro /dev/sda
> 2. blockdev --rereadpt /dev/sda
> 3. blockdev --getro /dev/sda
>
> This commit reads the disk's old state and combines it with the device
> disk-reported state rather than unconditionally marking it as RW.

> -               sdkp->write_prot = ((data.device_specific & 0x80) != 0);
> +               sdkp->write_prot = ((data.device_specific & 0x80) != 0) ||
> +                       disk_ro;

Perhaps
               sdkp->write_prot = (data.device_specific & 0x80) || disk_ro;

will save a line.

-- 
With Best Regards,
Andy Shevchenko



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux