hw/block/nvme: fix Close Zone
Implicitly and Explicitly Open zones can be closed by Close Zone management function. This got broken by a recent commit ("hw/block/nvme: refactor zone resource management") and now such commands fail with Invalid Zone State Transition status. Modify nvm_zrm_close() function to make Close Zone work correctly. Signed-off-by: Dmitry Fomichev <dmitry.fomichev@wdc.com> Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
This commit is contained in:
parent
e4e430b3d6
commit
92323c8c25
|
@ -1319,14 +1319,13 @@ static uint16_t nvme_zrm_finish(NvmeNamespace *ns, NvmeZone *zone)
|
||||||
static uint16_t nvme_zrm_close(NvmeNamespace *ns, NvmeZone *zone)
|
static uint16_t nvme_zrm_close(NvmeNamespace *ns, NvmeZone *zone)
|
||||||
{
|
{
|
||||||
switch (nvme_get_zone_state(zone)) {
|
switch (nvme_get_zone_state(zone)) {
|
||||||
case NVME_ZONE_STATE_CLOSED:
|
|
||||||
return NVME_SUCCESS;
|
|
||||||
|
|
||||||
case NVME_ZONE_STATE_EXPLICITLY_OPEN:
|
case NVME_ZONE_STATE_EXPLICITLY_OPEN:
|
||||||
case NVME_ZONE_STATE_IMPLICITLY_OPEN:
|
case NVME_ZONE_STATE_IMPLICITLY_OPEN:
|
||||||
nvme_aor_dec_open(ns);
|
nvme_aor_dec_open(ns);
|
||||||
nvme_assign_zone_state(ns, zone, NVME_ZONE_STATE_CLOSED);
|
nvme_assign_zone_state(ns, zone, NVME_ZONE_STATE_CLOSED);
|
||||||
/* fall through */
|
/* fall through */
|
||||||
|
case NVME_ZONE_STATE_CLOSED:
|
||||||
|
return NVME_SUCCESS;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return NVME_ZONE_INVAL_TRANSITION;
|
return NVME_ZONE_INVAL_TRANSITION;
|
||||||
|
|
Loading…
Reference in a new issue