[PATCH 0/1] nvmet: use subsys->max_nsid to report MNAN value

Chaitanya Kulkarni chaitanya.kulkarni at wdc.com
Sun Jun 13 18:37:53 PDT 2021


Hi,

Instaed of using the NVMET_MAX_NAMESPACS use subsys->nax_nsid to set
the MNAN value since nvmet controller supports the ANA Reporting.

Without this patch we get following error with connect command :-

[337976.409142] nvme nvme1: Invalid MNAN value 1024

I've ran blocktests [1] and they pass on the top of this patch on
nvme-5.14.

-ck

Chaitanya Kulkarni (1):
  nvmet: use subsys->max_nsid to report MNAN

 drivers/nvme/target/admin-cmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

# git log -1
commit 353d099f43f8372010bdfa16a9b6ef1cc0233b6f (HEAD -> nvme-5.14)
Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
Date:   Sat Jun 12 15:10:43 2021 -0700

    nvmet: use subsys->max_nsid to report MNAN
    
    For Spec regarding MNAN value:-
    
    If the controller supports Asymmetric Namespace Access Reporting, then
    this field shall be set to a non-zero value that is less than or equal
    to the NN value.
    
    Instead of using NVMET_MAX_NAMESPACES use subsys->max_nsid to set the
    MNAN value.
    
    Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
# git format-patch HEAD~1 --signoff 
0001-nvmet-use-subsys-max_nsid-to-report-MNAN.patch
# ./compile_nvme.sh 
+ umount /mnt/nvme0n1
+ clear_dmesg
umount: /mnt/nvme0n1: not mounted
+ modprobe -r nvme-fabrics
+ modprobe -r nvme_loop
+ modprobe -r nvmet
+ modprobe -r nvme
+ sleep 1
+ modprobe -r nvme-core
+ lsmod
+ grep nvme
+ git apply ./all-fixes.diff
+ sleep 1
+ git diff
diff --git a/drivers/nvme/target/loop.c b/drivers/nvme/target/loop.c
index cb30cb942e1d..a7f7b4dd8d37 100644
--- a/drivers/nvme/target/loop.c
+++ b/drivers/nvme/target/loop.c
@@ -692,7 +692,8 @@ static struct nvmf_transport_ops nvme_loop_transport = {
        .name           = "loop",
        .module         = THIS_MODULE,
        .create_ctrl    = nvme_loop_create_ctrl,
-       .allowed_opts   = NVMF_OPT_TRADDR,
+       .allowed_opts   = NVMF_OPT_TRADDR | NVMF_OPT_CTRL_LOSS_TMO,
+
 };
 
 static int __init nvme_loop_init_module(void)
+ sleep 1
++ nproc
+ make -j 64 M=drivers/nvme/ modules
  CC [M]  drivers/nvme//target/loop.o
  LD [M]  drivers/nvme//target/nvme-loop.o
  MODPOST drivers/nvme//Module.symvers
  LD [M]  drivers/nvme//target/nvme-loop.ko
+ HOST=drivers/nvme/host
+ TARGET=drivers/nvme/target
++ uname -r
+ HOST_DEST=/lib/modules/5.13.0-rc3nvme+/kernel/drivers/nvme/host/
++ uname -r
+ TARGET_DEST=/lib/modules/5.13.0-rc3nvme+/kernel/drivers/nvme/target/
+ cp drivers/nvme/host/nvme-core.ko drivers/nvme/host/nvme-fabrics.ko drivers/nvme/host/nvme-fc.ko drivers/nvme/host/nvme.ko drivers/nvme/host/nvme-rdma.ko drivers/nvme/host/nvme-tcp.ko /lib/modules/5.13.0-rc3nvme+/kernel/drivers/nvme/host//
+ cp drivers/nvme/target/nvme-fcloop.ko drivers/nvme/target/nvme-loop.ko drivers/nvme/target/nvmet-fc.ko drivers/nvme/target/nvmet.ko drivers/nvme/target/nvmet-rdma.ko drivers/nvme/target/nvmet-tcp.ko /lib/modules/5.13.0-rc3nvme+/kernel/drivers/nvme/target//
+ ls -lrth /lib/modules/5.13.0-rc3nvme+/kernel/drivers/nvme/host/ /lib/modules/5.13.0-rc3nvme+/kernel/drivers/nvme/target//
/lib/modules/5.13.0-rc3nvme+/kernel/drivers/nvme/host/:
total 9.1M
-rw-r--r--. 1 root root 4.0M Jun 13 14:23 nvme-core.ko
-rw-r--r--. 1 root root 639K Jun 13 14:23 nvme-fabrics.ko
-rw-r--r--. 1 root root 1.2M Jun 13 14:23 nvme-fc.ko
-rw-r--r--. 1 root root 1.1M Jun 13 14:23 nvme.ko
-rw-r--r--. 1 root root 1.2M Jun 13 14:23 nvme-rdma.ko
-rw-r--r--. 1 root root 1.1M Jun 13 14:23 nvme-tcp.ko

/lib/modules/5.13.0-rc3nvme+/kernel/drivers/nvme/target//:
total 8.3M
-rw-r--r--. 1 root root 718K Jun 13 14:23 nvme-fcloop.ko
-rw-r--r--. 1 root root 623K Jun 13 14:23 nvme-loop.ko
-rw-r--r--. 1 root root 1.1M Jun 13 14:23 nvmet-fc.ko
-rw-r--r--. 1 root root 4.0M Jun 13 14:23 nvmet.ko
-rw-r--r--. 1 root root 1.1M Jun 13 14:23 nvmet-rdma.ko
-rw-r--r--. 1 root root 868K Jun 13 14:23 nvmet-tcp.ko
+ modprobe nvme
+ git co drivers/nvme/target/loop.c
Updated 1 path from the index
# cdblktests 
 blktests (master) # ./check nvme-
./check: no group or test named nvme-
 blktests (master) # ./check nvme
nvme/002 (create many subsystems and test discovery)         [passed]
    runtime  41.158s  ...  40.884s
nvme/003 (test if we're sending keep-alives to a discovery controller) [passed]
    runtime  10.194s  ...  10.179s
nvme/004 (test nvme and nvmet UUID NS descriptors)           [passed]
    runtime  1.780s  ...  1.790s
nvme/005 (reset local loopback target)                       [passed]
    runtime  2.249s  ...  2.229s
nvme/006 (create an NVMeOF target with a block device-backed ns) [passed]
    runtime  0.156s  ...  0.157s
nvme/007 (create an NVMeOF target with a file-backed ns)     [passed]
    runtime  0.107s  ...  0.100s
nvme/008 (create an NVMeOF host with a block device-backed ns) [passed]
    runtime  1.794s  ...  1.810s
nvme/009 (create an NVMeOF host with a file-backed ns)       [passed]
    runtime  1.745s  ...  1.758s
nvme/010 (run data verification fio job on NVMeOF block device-backed ns) [passed]
    runtime  42.438s  ...  36.312s
nvme/011 (run data verification fio job on NVMeOF file-backed ns) [passed]
    runtime  325.840s  ...  305.214s
nvme/012 (run mkfs and data verification fio job on NVMeOF block device-backed ns) [passed]
    runtime  9.217s  ...  9.089s
nvme/013 (run mkfs and data verification fio job on NVMeOF file-backed ns) [passed]
    runtime  25.653s  ...  23.342s
nvme/014 (flush a NVMeOF block device-backed ns)             [passed]
    runtime  21.644s  ...  20.553s
nvme/015 (unit test for NVMe flush for file backed ns)       [passed]
    runtime  21.054s  ...  20.377s
nvme/016 (create/delete many NVMeOF block device-backed ns and test discovery) [passed]
    runtime  21.955s  ...  21.895s
nvme/017 (create/delete many file-ns and test discovery)     [passed]
    runtime  22.402s  ...  21.234s
nvme/018 (unit test NVMe-oF out of range access on a file backend) [passed]
    runtime  1.782s  ...  1.755s
nvme/019 (test NVMe DSM Discard command on NVMeOF block-device ns) [passed]
    runtime  2.332s  ...  1.785s
nvme/020 (test NVMe DSM Discard command on NVMeOF file-backed ns) [passed]
    runtime  1.952s  ...  1.747s
nvme/021 (test NVMe list command on NVMeOF file-backed ns)   [passed]
    runtime  1.966s  ...  1.790s
nvme/022 (test NVMe reset command on NVMeOF file-backed ns)  [passed]
    runtime  2.183s  ...  2.192s
nvme/023 (test NVMe smart-log command on NVMeOF block-device ns) [passed]
    runtime  1.831s  ...  1.828s
nvme/024 (test NVMe smart-log command on NVMeOF file-backed ns) [passed]
    runtime  1.748s  ...  1.734s
nvme/025 (test NVMe effects-log command on NVMeOF file-backed ns) [passed]
    runtime  1.749s  ...  1.748s
nvme/026 (test NVMe ns-descs command on NVMeOF file-backed ns) [passed]
    runtime  1.859s  ...  1.745s
nvme/027 (test NVMe ns-rescan command on NVMeOF file-backed ns) [passed]
    runtime  1.777s  ...  1.745s
nvme/028 (test NVMe list-subsys command on NVMeOF file-backed ns) [passed]
    runtime  1.764s  ...  1.740s
nvme/029 (test userspace IO via nvme-cli read/write interface) [passed]
    runtime  2.277s  ...  2.245s
nvme/030 (ensure the discovery generation counter is updated appropriately) [passed]
    runtime  0.422s  ...  0.414s
nvme/031 (test deletion of NVMeOF controllers immediately after setup) [passed]
    runtime  5.982s  ...  6.045s
nvme/038 (test deletion of NVMeOF subsystem without enabling) [passed]
    runtime  0.060s  ...  0.063s


-- 
2.22.1




More information about the Linux-nvme mailing list