[PATCH] nvme: Fix zns drives without append support to export correct permissions

Damien Le Moal damien.lemoal at opensource.wdc.com
Mon Mar 14 02:21:19 PDT 2022


On 3/14/22 17:44, Christoph Hellwig wrote:
> On Mon, Mar 14, 2022 at 09:36:35AM +0100, Pankaj Raghav wrote:
>> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
>> index 51c08f206cbf..cde33f2a3a5a 100644
>> --- a/drivers/nvme/host/core.c
>> +++ b/drivers/nvme/host/core.c
>> @@ -1855,8 +1855,7 @@ static void nvme_update_disk_info(struct gendisk
>> *disk,
>>  	blk_queue_max_write_zeroes_sectors(disk->queue,
>>  					   ns->ctrl->max_zeroes_sectors);
>>
>> -	set_disk_ro(disk, (id->nsattr & NVME_NS_ATTR_RO) ||
>> -		test_bit(NVME_NS_FORCE_RO, &ns->flags));
>> +	set_disk_ro(disk, (id->nsattr & NVME_NS_ATTR_RO));
>>  }
> 
> This creates a race window during revalidation where the zone will be
> set writable here only to be set read-only again a little later.

Then the only good solution is to have the RO flag set before calling
device_add_disk(), no ?

-- 
Damien Le Moal
Western Digital Research



More information about the Linux-nvme mailing list