[PATCH 00/10] nvmet: fixes and some cleanups

Chaitanya Kulkarni chaitanya.kulkarni at wdc.com
Mon Feb 1 00:41:28 EST 2021


Hi,

This patch-series fixes behavior for id-ns that is against the spec and
does cleanup for nvmet_find_namespace() to get rid of the duplicate code
and remove the inconsistent error behavior of the host, Also this adds
an helper for unhandled commands to have uniform error message
reporting for the bdev, file and passthru backend. Last two patches
fix compilation warnings.

This is based on nvme-5.12. All the blktests are seem to pass on this
series.                

-ck

Chaitanya Kulkarni (10):
  nvmet: zeroout id-ns buffer for invalid nsid
  nvmet: return uniform error for invalid ns
  nvmet: set error in nvmet_find_namespace()
  nvmet: remove nsid param from nvmet_find_namespace()
  nvmet: remove extra variable in is-ns handler
  nvmet: add helper to report invalid opcode
  nvmet: use invalid cmd opcode helper
  nvmet: use invalid cmd opcode helper
  nvmet: use min of device_path and disk len
  nvme-loop: rename variable to get rid of the warn

 drivers/nvme/target/admin-cmd.c   | 63 +++++++++++++++----------------
 drivers/nvme/target/core.c        | 23 +++++------
 drivers/nvme/target/io-cmd-bdev.c |  5 +--
 drivers/nvme/target/io-cmd-file.c |  5 +--
 drivers/nvme/target/loop.c        |  2 +-
 drivers/nvme/target/nvmet.h       | 22 ++++++++++-
 drivers/nvme/target/passthru.c    |  2 +-
 drivers/nvme/target/trace.h       |  4 +-
 8 files changed, 70 insertions(+), 56 deletions(-)

# gitlog -11
6eb10edb698e (HEAD -> nvme-5.12) nvme-loop: rename variable to get rid of the warn
d94df0995f71 nvmet: use min of device_path and disk len
a98b4f9e46e0 nvmet: use invalid cmd opcode helper
a3ca782d82e5 nvmet: use invalid cmd opcode helper
102c6698b403 nvmet: add helper to report invalid opcode
eed0b3baae83 nvmet: remove extra variable in is-ns handler
4b47817fab94 nvmet: remove nsid param from nvmet_find_namespace()
68a97104491a nvmet: set error in nvmet_find_namespace()
e4079ffeb06e nvmet: return uniform error for invalid ns
5102bfe49832 nvmet: zeroout id-ns buffer for invalid nsid
ab9dbdb20926 (origin/nvme-5.12) nvme-tcp: use cancel tagset helper for tear down

blktests (master) # ./check tests/nvme
nvme/002 (create many subsystems and test discovery)         [passed]
    runtime  26.465s  ...  25.746s
nvme/003 (test if we're sending keep-alives to a discovery controller) [passed]
    runtime  10.135s  ...  10.134s
nvme/004 (test nvme and nvmet UUID NS descriptors)           [passed]
    runtime  1.677s  ...  1.708s
nvme/005 (reset local loopback target)                       [not run]
    nvme_core module does not have parameter multipath
nvme/006 (create an NVMeOF target with a block device-backed ns) [passed]
    runtime  0.120s  ...  0.115s
nvme/007 (create an NVMeOF target with a file-backed ns)     [passed]
    runtime  0.071s  ...  0.069s
nvme/008 (create an NVMeOF host with a block device-backed ns) [passed]
    runtime  1.691s  ...  1.693s
nvme/009 (create an NVMeOF host with a file-backed ns)       [passed]
    runtime  1.667s  ...  1.648s
nvme/010 (run data verification fio job on NVMeOF block device-backed ns) [passed]
    runtime  26.581s  ...  32.500s
nvme/011 (run data verification fio job on NVMeOF file-backed ns) [passed]
    runtime  274.955s  ...  256.070s
nvme/012 (run mkfs and data verification fio job on NVMeOF block device-backed ns) [passed]
    runtime  45.972s  ...  39.458s
nvme/013 (run mkfs and data verification fio job on NVMeOF file-backed ns) [passed]
    runtime  274.262s  ...  285.493s
nvme/014 (flush a NVMeOF block device-backed ns)             [passed]
    runtime  21.649s  ...  20.740s
nvme/015 (unit test for NVMe flush for file backed ns)       [passed]
    runtime  19.500s  ...  18.742s
nvme/016 (create/delete many NVMeOF block device-backed ns and test discovery) [passed]
    runtime  14.570s  ...  14.262s
nvme/017 (create/delete many file-ns and test discovery)     [passed]
    runtime  14.831s  ...  14.774s
nvme/018 (unit test NVMe-oF out of range access on a file backend) [passed]
    runtime  1.646s  ...  1.654s
nvme/019 (test NVMe DSM Discard command on NVMeOF block-device ns) [passed]
    runtime  1.689s  ...  1.708s
nvme/020 (test NVMe DSM Discard command on NVMeOF file-backed ns) [passed]
    runtime  1.638s  ...  1.651s
nvme/021 (test NVMe list command on NVMeOF file-backed ns)   [passed]
    runtime  1.659s  ...  1.685s
nvme/022 (test NVMe reset command on NVMeOF file-backed ns)  [passed]
    runtime  2.089s  ...  2.078s
nvme/023 (test NVMe smart-log command on NVMeOF block-device ns) [passed]
    runtime  1.670s  ...  1.680s
nvme/024 (test NVMe smart-log command on NVMeOF file-backed ns) [passed]
    runtime  1.640s  ...  1.644s
nvme/025 (test NVMe effects-log command on NVMeOF file-backed ns) [passed]
    runtime  1.646s  ...  1.655s
nvme/026 (test NVMe ns-descs command on NVMeOF file-backed ns) [passed]
    runtime  1.654s  ...  1.637s
nvme/027 (test NVMe ns-rescan command on NVMeOF file-backed ns) [passed]
    runtime  1.722s  ...  1.655s
nvme/028 (test NVMe list-subsys command on NVMeOF file-backed ns) [passed]
    runtime  1.641s  ...  1.679s
nvme/029 (test userspace IO via nvme-cli read/write interface) [passed]
    runtime  1.999s  ...  2.016s
nvme/030 (ensure the discovery generation counter is updated appropriately) [passed]
    runtime  0.305s  ...  0.290s
nvme/031 (test deletion of NVMeOF controllers immediately after setup) [passed]
    runtime  5.488s  ...  5.596s
nvme/038 (test deletion of NVMeOF subsystem without enabling) [passed]
    runtime  0.043s  ...  0.043s

Tracing test :-

nvmet_req_init: nvmet1: qid=0, cmdid=2, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_admin_identify, cns=3, ctrlid=0)
nvmet_req_init: nvmet1: qid=0, cmdid=3, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_admin_identify, cns=0, ctrlid=0)
nvmet_req_init: nvmet1: disk=/dev/nullb0, qid=10, cmdid=81, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_cmd_read, slba=0, len=0, ctrl=0x0, dsmgmt=0, reftag=0)
nvmet_req_init: nvmet1: disk=/dev/nullb0, qid=10, cmdid=82, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_cmd_read, slba=1, len=0, ctrl=0x0, dsmgmt=0, reftag=0)
nvmet_req_init: nvmet1: disk=/dev/nullb0, qid=23, cmdid=113, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_cmd_read, slba=5368709104, len=0, ctrl=0x8000, dsmgmt=7, reftag=0)
nvmet_req_init: nvmet1: disk=/dev/nullb0, qid=23, cmdid=114, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_cmd_read, slba=5368709118, len=0, ctrl=0x8000, dsmgmt=7, reftag=0)
nvmet_req_init: nvmet1: disk=/dev/nullb0, qid=23, cmdid=115, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_cmd_read, slba=0, len=0, ctrl=0x8000, dsmgmt=7, reftag=0)
nvmet_req_init: nvmet1: disk=/dev/nullb0, qid=23, cmdid=116, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_cmd_read, slba=1, len=0, ctrl=0x8000, dsmgmt=7, reftag=0)
nvmet_req_init: nvmet1: disk=/dev/nullb0, qid=23, cmdid=117, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_cmd_read, slba=5368709119, len=0, ctrl=0x8000, dsmgmt=7, reftag=0)
nvmet_req_init: nvmet1: disk=/dev/nullb0, qid=23, cmdid=118, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_cmd_read, slba=5368709087, len=0, ctrl=0x8000, dsmgmt=7, reftag=0)
nvmet_req_init: nvmet1: disk=/dev/nullb0, qid=23, cmdid=119, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_cmd_read, slba=5368709112, len=0, ctrl=0x8000, dsmgmt=7, reftag=0)
nvmet_req_init: nvmet1: disk=/dev/nullb0, qid=23, cmdid=120, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_cmd_read, slba=5368709088, len=0, ctrl=0x8000, dsmgmt=7, reftag=0)
nvmet_req_init: nvmet1: disk=/dev/nullb0, qid=23, cmdid=121, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_cmd_read, slba=5368709070, len=0, ctrl=0x8000, dsmgmt=7, reftag=0)
nvmet_req_init: nvmet1: disk=/dev/nullb0, qid=23, cmdid=122, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_cmd_read, slba=5368709046, len=0, ctrl=0x8000, dsmgmt=7, reftag=0)
nvmet_req_init: nvmet1: disk=/dev/nullb0, qid=23, cmdid=123, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_cmd_read, slba=5368709035, len=0, ctrl=0x8000, dsmgmt=7, reftag=0)
nvmet_req_init: nvmet1: disk=/dev/nullb0, qid=23, cmdid=124, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_cmd_read, slba=5368709028, len=0, ctrl=0x8000, dsmgmt=7, reftag=0)
nvmet_req_init: nvmet1: disk=/dev/nullb0, qid=23, cmdid=125, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_cmd_read, slba=5368709006, len=0, ctrl=0x8000, dsmgmt=7, reftag=0)
nvmet_req_init: nvmet1: disk=/dev/nullb0, qid=23, cmdid=126, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_cmd_read, slba=5368708998, len=0, ctrl=0x8000, dsmgmt=7, reftag=0)
nvmet_req_init: nvmet1: disk=/dev/nullb0, qid=23, cmdid=127, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_cmd_read, slba=5368708996, len=0, ctrl=0x8000, dsmgmt=7, reftag=0)
nvmet_req_init: nvmet1: disk=/dev/nullb0, qid=23, cmdid=113, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_cmd_read, slba=5368709001, len=0, ctrl=0x8000, dsmgmt=7, reftag=0)
nvmet_req_init: nvmet1: disk=/dev/nullb0, qid=23, cmdid=114, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_cmd_read, slba=5368708734, len=0, ctrl=0x8000, dsmgmt=7, reftag=0)
nvmet_req_init: nvmet1: disk=/dev/nullb0, qid=23, cmdid=115, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_cmd_read, slba=256, len=0, ctrl=0x8000, dsmgmt=7, reftag=0)
nvmet_req_init: nvmet1: disk=/dev/nullb0, qid=23, cmdid=116, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_cmd_read, slba=3, len=0, ctrl=0x8000, dsmgmt=7, reftag=0)
nvmet_req_init: nvmet1: disk=/dev/nullb0, qid=23, cmdid=117, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_cmd_read, slba=7, len=0, ctrl=0x8000, dsmgmt=7, reftag=0)
nvmet_req_init: nvmet1: disk=/dev/nullb0, qid=23, cmdid=118, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_cmd_read, slba=15, len=0, ctrl=0x8000, dsmgmt=7, reftag=0)
nvmet_req_init: nvmet1: disk=/dev/nullb0, qid=23, cmdid=119, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_cmd_read, slba=2, len=0, ctrl=0x8000, dsmgmt=7, reftag=0)
nvmet_req_init: nvmet1: disk=/dev/nullb0, qid=23, cmdid=120, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_cmd_read, slba=4, len=2, ctrl=0x8000, dsmgmt=7, reftag=0)
nvmet_req_init: nvmet1: disk=/dev/nullb0, qid=23, cmdid=121, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_cmd_read, slba=8, len=6, ctrl=0x8000, dsmgmt=7, reftag=0)
nvmet_req_init: nvmet1: disk=/dev/nullb0, qid=23, cmdid=122, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_cmd_read, slba=16, len=47, ctrl=0x8000, dsmgmt=7, reftag=0)
nvmet_req_init: nvmet1: disk=/dev/nullb0, qid=23, cmdid=123, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_cmd_read, slba=64, len=63, ctrl=0x8000, dsmgmt=7, reftag=0)
nvmet_req_init: nvmet1: disk=/dev/nullb0, qid=23, cmdid=124, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_cmd_read, slba=5368708992, len=3, ctrl=0x8000, dsmgmt=7, reftag=0)
nvmet_req_init: nvmet1: disk=/dev/nullb0, qid=23, cmdid=125, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_cmd_read, slba=5368708997, len=0, ctrl=0x8000, dsmgmt=7, reftag=0)
nvmet_req_init: nvmet1: disk=/dev/nullb0, qid=23, cmdid=126, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_cmd_read, slba=5368708999, len=1, ctrl=0x8000, dsmgmt=7, reftag=0)
nvmet_req_init: nvmet1: disk=/dev/nullb0, qid=23, cmdid=127, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_cmd_read, slba=5368709002, len=3, ctrl=0x8000, dsmgmt=7, reftag=0)
nvmet_req_init: nvmet1: disk=/dev/nullb0, qid=23, cmdid=113, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_cmd_read, slba=5368709007, len=20, ctrl=0x8000, dsmgmt=7, reftag=0)
nvmet_req_init: nvmet1: disk=/dev/nullb0, qid=23, cmdid=114, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_cmd_read, slba=5368709029, len=5, ctrl=0x8000, dsmgmt=7, reftag=0)
nvmet_req_init: nvmet1: disk=/dev/nullb0, qid=23, cmdid=115, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_cmd_read, slba=5368709036, len=9, ctrl=0x8000, dsmgmt=7, reftag=0)
nvmet_req_init: nvmet1: disk=/dev/nullb0, qid=23, cmdid=116, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_cmd_read, slba=5368709047, len=8, ctrl=0x8000, dsmgmt=7, reftag=0)
nvmet_req_init: nvmet1: disk=/dev/nullb0, qid=23, cmdid=117, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_cmd_read, slba=5368709056, len=13, ctrl=0x8000, dsmgmt=7, reftag=0)
nvmet_req_init: nvmet1: disk=/dev/nullb0, qid=23, cmdid=118, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_cmd_read, slba=5368709071, len=15, ctrl=0x8000, dsmgmt=7, reftag=0)
nvmet_req_init: nvmet1: disk=/dev/nullb0, qid=23, cmdid=119, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_cmd_read, slba=5368709089, len=14, ctrl=0x8000, dsmgmt=7, reftag=0)
nvmet_req_init: nvmet1: disk=/dev/nullb0, qid=23, cmdid=120, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_cmd_read, slba=5368709105, len=6, ctrl=0x8000, dsmgmt=7, reftag=0)
nvmet_req_init: nvmet1: disk=/dev/nullb0, qid=23, cmdid=121, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_cmd_read, slba=5368709113, len=4, ctrl=0x8000, dsmgmt=7, reftag=0)
nvmet_req_init: nvmet1: disk=/dev/nullb0, qid=23, cmdid=122, nsid=1, flags=0x40, meta=0x0, cmd=(nvme_cmd_read, slba=512, len=0, ctrl=0x8000, dsmgmt=7, reftag=0)
kkjkj
-- 
2.22.1




More information about the Linux-nvme mailing list