When trying to release a reservation, if the user specified the wrong reservation type, libmpathpersist would try to preempt the reservation, because the reservation key matched the device key, but it was not removed. In this case, the preemption would also fail because it also requires a matching type.
Check if the reservation type matches, to avoid attempting the workaround in this case. Signed-off-by: Benjamin Marzinski <bmarz...@redhat.com> --- libmpathpersist/mpath_persist_int.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libmpathpersist/mpath_persist_int.c b/libmpathpersist/mpath_persist_int.c index 979b0d6c..a28e55b3 100644 --- a/libmpathpersist/mpath_persist_int.c +++ b/libmpathpersist/mpath_persist_int.c @@ -566,6 +566,7 @@ static int mpath_prout_rel(struct multipath *mpp,int rq_servact, int rq_scope, uint16_t udev_flags = (mpp->skip_kpartx) ? MPATH_UDEV_NO_KPARTX_FLAG : 0; bool did_resume = false; bool all_threads_failed; + unsigned int scope_type; if (!mpp) return MPATH_PR_DMMP_ERROR; @@ -661,6 +662,13 @@ static int mpath_prout_rel(struct multipath *mpp,int rq_servact, int rq_scope, return MPATH_PR_SUCCESS; } + scope_type = resp.prin_descriptor.prin_readresv.scope_type; + if ((scope_type & MPATH_PR_TYPE_MASK) != rq_type) { + condlog(2, "%s: --prout_type %u doesn't match reservation %u", + mpp->wwid, rq_type, scope_type & MPATH_PR_TYPE_MASK); + return MPATH_PR_RESERV_CONFLICT; + } + condlog (2, "%s: Path holding reservation is not available.", mpp->wwid); /* * Cannot free the reservation because the path that is holding it -- 2.50.1