Skip to content

RFC nvmet-fc blktests & autoconnect fixes

Daniel Wagner linux-nvme lkml oe-kbuild-all 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest4 patches 17 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4nvmet-trace: avoid dereferencing pointer too earlydrivers/nvme/target/trace.h+13 -114 replies
2/4nvmet-trace: null terminate device name string correctlydrivers/nvme/target/trace.h+2 -23 replies
3/4nvmet-fc: untangle cross refcounting objectsdrivers/nvme/target/fc.c+33 -342 replies
4/4nvmet-discovery: Do not use invalid portdrivers/nvme/target/discovery.c+9 -00 replies
4/4nvmet-discovery: do not use invalid portdrivers/nvme/target/discovery.c+9 -08 replies

Reviews trailers per patch

2 of 5 patches have a Reviewed-by or Acked-by.

PatchHannes Reinecke
1/4R-b
2/4R-b
3/4
4/4
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [RFC v1 0/4] nvmet-fc blktests & autoconnect fixes

Currently, blktests will pass with the patches [1] and the revert of [2]. This is possible because blktests is still disables the nvmf-autoconnect auto connect service [3].

As I previously reported, blktests is able to trigger various kernel panics with the system auto-connect running in the background. Let's try to fix these problems.

The first two patches are fixing nvmet ftrace infrastructure. I think they could go in right now.

The third patch changes the way the refcounting for association and queues is done. There is a cycling dependency between these two objects and this makes the shutdown path very complex and error prone. As the life time of the queues is coupled to the association, I decided to drop the refcounting of the queues and only rely on the refcounts of the association. This made the code a bit simpler to follow and also allowed to cleanup path to split into two halfs. The first one is to remove the association from the association RCU list and wait for an grace period so we know that now new I/Os will enter any queues. Then we drop the refcounts and then actually remove any resources when the refcount drops to 0 (all in-flight I/O has been processed). nvme/003 is particular good in triggering crashes in this path.

nvme/005 is triggering crashes in get discovery log page. The req->port pointer was never assign a valid pointer. This looks like there is way to have no port entry binding (remember we have the external autoconnect running in background).

Unfortunately, there are still some more fallouts, but I though I post these patches now when my memory is fresh if there are any questions.

[1] https://lore.kernel.org/linux-nvme/sgoyzwj6ckrdrpq22u6fhtcemul5rqj6de4l5gw73vz77o3ils@vmv3jue4rom7/
[2] linux: ee6fdc5055e9 ("nvme-fc: fix race between error recovery and creating association")
[3] blktests: 0478dce70696 ("nvme/rc: Avoid triggering host nvme-cli autoconnect")

Daniel Wagner (4):
nvmet-trace: avoid dereferencing pointer too early
nvmet-trace: null terminate device name string correctly
nvmet-fc: untangle cross refcounting objects
nvmet-discovery: do not use invalid port

 drivers/nvme/target/discovery.c |  9 +++++
 drivers/nvme/target/fc.c        | 67 ++++++++++++++++-----------------
 drivers/nvme/target/trace.c     |  6 +--
 drivers/nvme/target/trace.h     | 28 +++++++-------
 4 files changed, 60 insertions(+), 50 deletions(-)
Signature · 1 line
2.41.0