lkml.org 
[lkml]   [2022]   [Mar]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] driver/nvme/host: Support duplicated nsid for the private
On Mon, Mar 14, 2022 at 04:05:05PM +0900, Sungup Moon wrote:
> When the multi-controller, managed by a special admin command, has private
> namespace with same nsid, current linux driver raise "Duplicate unshared
> namespace" error. But, NVMe Specification defines the NSID usage like this:
>
> If Namespace Management, ANA Reporting, or NVM Sets are supported, the
> NSIDs shall be unique within the NVM subsystem. If the Namespace
> Management, ANA Reporting, and NVM Sets are not supported, then NSIDs:
> a) for shared namespace shall be unique; and
> b) for private namespace are not required to be unique.
> (reference: 6.1.6 NSID and Namespace Usage; NVM Express 1.4c spec)
>
> So, if a multi-controller, which is not managed by Namespace Management
> function, creates some private namespaces without ANA and NVM Sets, the
> duplicated NSID should be allowed because that is not a NVMe specification
> violation.
>
> But, current nvme driver checks only namespace is shared or not, so I
> propose following patch:
> 1. nvme_ctrl has unique_nsid field to identify that controller should
> assign unique nsid.
> 2. nvme_init_ns_head function creates new nvme_ns_head instance not only
> head is null but controller's unique_nsid is false (no flagged
> attribute) and namespace is not shared.
> 3. for creating bdev device file, nvme_mpath_set_disk_name will return
> false when unique_nsid is false and namespace is not shared.
> 4. also, nvme_mpath_alloc_disk alto return 0 with same manner.

From a very quick glance this looks good. But please make sure you don't
spill over 80 charactes per line. Also I think instead of adding the
unique_nsid field a little helper that checks the relevant flags might
be a lіttle nicer. It is not checked in a fast path anywere and the
checks are pretty trivial.

\
 
 \ /
  Last update: 2022-03-14 08:09    [W:0.052 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site