lkml.org 
[lkml]   [2022]   [Aug]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.18 0819/1095] nvme: catch -ENODEV from nvme_revalidate_zones again
    Date
    From: Christoph Hellwig <hch@lst.de>

    [ Upstream commit e06b425bc835ead08b9fd935bf5e47eef473e7a0 ]

    nvme_revalidate_zones can also return -ENODEV if e.g. zone sizes aren't
    constant or not a power of two. In that case we should jump to marking
    the gendisk hidden and only support pass through.

    Fixes: 602e57c9799c ("nvme: also mark passthrough-only namespaces ready in nvme_update_ns_info")
    Reported-by: Joel Granados <j.granados@samsung.com>
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Joel Granados <j.granados@samsung.com>
    Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    drivers/nvme/host/core.c | 13 +++++++------
    1 file changed, 7 insertions(+), 6 deletions(-)

    diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
    index cf7be9b4f5d3..a58a69999dbc 100644
    --- a/drivers/nvme/host/core.c
    +++ b/drivers/nvme/host/core.c
    @@ -1897,8 +1897,10 @@ static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_id_ns *id)

    if (ns->head->ids.csi == NVME_CSI_ZNS) {
    ret = nvme_update_zone_info(ns, lbaf);
    - if (ret)
    - goto out_unfreeze;
    + if (ret) {
    + blk_mq_unfreeze_queue(ns->disk->queue);
    + goto out;
    + }
    }

    set_disk_ro(ns->disk, (id->nsattr & NVME_NS_ATTR_RO) ||
    @@ -1909,7 +1911,7 @@ static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_id_ns *id)
    if (blk_queue_is_zoned(ns->queue)) {
    ret = nvme_revalidate_zones(ns);
    if (ret && !nvme_first_scan(ns->disk))
    - return ret;
    + goto out;
    }

    if (nvme_ns_head_multipath(ns->head)) {
    @@ -1924,9 +1926,9 @@ static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_id_ns *id)
    disk_update_readahead(ns->head->disk);
    blk_mq_unfreeze_queue(ns->head->disk->queue);
    }
    - return 0;

    -out_unfreeze:
    + ret = 0;
    +out:
    /*
    * If probing fails due an unsupported feature, hide the block device,
    * but still allow other access.
    @@ -1936,7 +1938,6 @@ static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_id_ns *id)
    set_bit(NVME_NS_READY, &ns->flags);
    ret = 0;
    }
    - blk_mq_unfreeze_queue(ns->disk->queue);
    return ret;
    }

    --
    2.35.1


    \
     
     \ /
      Last update: 2022-08-16 00:29    [W:2.842 / U:0.972 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site