dm: Fix PR release handling for non All Registrants
authorMike Christie <michael.christie@oracle.com>
Sun, 17 Jul 2022 22:45:07 +0000 (17:45 -0500)
committerMike Snitzer <snitzer@kernel.org>
Thu, 28 Jul 2022 21:29:56 +0000 (17:29 -0400)
commit08a3c338e080d25dd5613a22d71741f19fc0e0fa
treecaaf8a85a6f1c9518b9bba81c3a0937901c63a49
parent701510875975ed7e188566de205990d29f34c8d8
dm: Fix PR release handling for non All Registrants

This commit fixes a bug where we are leaving the reservation in place
even though pr_release has run and returned success.

If we have a Write Exclusive, Exclusive Access, or Write/Exclusive
Registrants only reservation, the release must be sent down the path
that is the reservation holder. The problem is multipath_prepare_ioctl
most likely selected path N for the reservation, then later when we do
the release multipath_prepare_ioctl will select a completely different
path. The device will then return success becuase the nvme and scsi
specs say to return success if there is no reservation or if the
release is sent down from a path that is not the holder. We then think
we have released the reservation.

This commit has us loop over each path and send a release so we can
make sure the release is executed on the correct path. It has been
tested with windows failover clustering's validation test which checks
this case, and it has been tested manually (the libiscsi PGR tests
don't have a test case for this yet, but I will be adding one).

Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
drivers/md/dm.c