[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75Vc6g1+sO_xD=FPdBd8dZJqqA_Se6N3EnZav8uGKex6_fg@mail.gmail.com>
Date: Thu, 1 Mar 2018 16:14:55 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Jeremy Cline <jeremy@...ine.org>
Cc: "James E . J . Bottomley" <jejb@...ux.vnet.ibm.com>,
"Martin K . Petersen" <martin.petersen@...cle.com>,
linux-scsi <linux-scsi@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] scsi: sd: Keep disk read-only when re-reading partition
On Thu, Mar 1, 2018 at 4:08 PM, Jeremy Cline <jeremy@...ine.org> 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
Powered by blists - more mailing lists