OSDN Git Service

nvme-fc: Reattach to localports on re-registration
authorJames Smart <jsmart2021@gmail.com>
Mon, 31 Jul 2017 20:20:30 +0000 (13:20 -0700)
committerSagi Grimberg <sagi@grimberg.me>
Mon, 28 Aug 2017 20:00:40 +0000 (23:00 +0300)
commit5533d42480d6ced6765401c55a3622b4c437d7eb
treee915aff29178ad65a8feb7418fb3a3aa11859521
parent60b43f627a71aaf233ef5af90f72e207c29781b4
nvme-fc: Reattach to localports on re-registration

If the LLDD resets or detaches from an fc port, the LLDD will
deregister all remoteports seen by the fc port and deregister the
localport associated with the fc port. The teardown of the localport
structure will be held off due to reference counting until all the
remoteports are removed (and they are held off until all
controllers/associations to terminated). Currently, if the fc port
is reinit/reattached and registered again as a localport it is
treated as an independent entity from the prior localport and all
prior remoteports and controllers cannot be revived. They are
created as new and separate entities.

This patch changes the localport registration to look at the known
localports that are waiting to be torndown. If they are the same port
based on wwn's, the local port is transitioned out of the teardown
state.  This allows the remote ports and controller connections to
be reestablished and resumed as long as the localport can also be
reregistered within the timeout windows.

The patch adds a new routine nvme_fc_attach_to_unreg_lport() with
the functionality and moves the lport get/put routines to avoid
forward references.

Signed-off-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/fc.c