[PATCH rfc 2/2] nvmet: expose option to emulate a nvm subsystem in read-only mode

Sagi Grimberg sagi at grimberg.me
Mon Dec 4 23:22:05 PST 2017


>> Can you please elaborate what you mean? are you talking about this
>> patch in particular (simply an emulation)? or support for this
>> altogether? A subsystem can, at any point, be placed in read-only mode.
>> In that case it needs to send SMART AER to indicate health status
>> change. I think that if the media has been placed in read-only mode, we
>> need to log it, and set all the subsystem namespaces in read-only mode.
>>
>> Anything different you think we need to do here?
> 
> Yes, but for that we should trigger it off gettind a EROFS warning
> from the block device, not through sysfs.

Just to be clear, that is exactly what I intended to do.

fs/block_dev.c checks bdev_read_only() in blkdev_write_iter and also
there is a patchset to enforce this for several places in the block
layer from Ilya Dryomov ("block: enforce ioctl(BLKROSET) and
set_disk_ro()")

I wander if we need this also in generic_write_checks()?

> Having the explicit sysfs
> no, and the code to send the AER on connect suggests to me that
> this was intended to be used to emulate a r/o setting, but apparently
> I was wrong.

I'm not sure I understand your point here, can you explain what you
mean?

nvmet sends a smart AER in case a host connected to a subsystem
in r/o state because there no other way it will know that (other than
failing writes when they come). Its just an attempt to notify the host
right away instead of waiting for it to issue writes and fail later.



More information about the Linux-nvme mailing list