Re: [PATCH] nvme: add support namespace management to sysfs

Keith Busch
2021-02-20T15:50:58Z

On Sun, Feb 21, 2021 at 12:40:04AM +0900, Minwoo Im wrote:
> Namespaces are generally managed by scan_work. If admin needs to attach
> namespace to controller, admin command like `nvme-cli` should be issued
> with rescanning controller.
>
> If admin issues a Namespace Attachment command with detach option to a
> namespace through IOCTL, kernel is not aware of it. In this case, block
> device for the namespace becomes meaningless, but still shown in the
> kernel space as maintained. After the rescanning the controller
> manually, namespace node will be removed from the driver and user-space
> will not be able to I/O to the namespace.
>
> Add support for namespace management (attach/detach) to sysfs of
> controller instance to make it easy to attach/detach namespaces with
> kernel-aware rather than non-kernel-aware passthru via IOCTL. Also, it
> provides closer relationship between the device and kernel for the
> namespace perspective (tightly coupled).

Nak. The kernel should be aware of the altered namespace inventory via
Command Effects Log or Namespace Notify AER. If the controller doesn't
support either of these, then the user gets to do a manual rescan, which
is not difficult task either.