• J
    dm table: fix iterate_devices based device capability checks · a87da24e
    Jeffle Xu 提交于
    stable inclusion
    from linux-4.19.180
    commit adbe8d9d3d45e02271f28f212375c67c30ced700
    
    --------------------------------
    
    commit a4c8dd9c upstream.
    
    According to the definition of dm_iterate_devices_fn:
     * This function must iterate through each section of device used by the
     * target until it encounters a non-zero return code, which it then returns.
     * Returns zero if no callout returned non-zero.
    
    For some target type (e.g. dm-stripe), one call of iterate_devices() may
    iterate multiple underlying devices internally, in which case a non-zero
    return code returned by iterate_devices_callout_fn will stop the iteration
    in advance. No iterate_devices_callout_fn should return non-zero unless
    device iteration should stop.
    
    Rename dm_table_requires_stable_pages() to dm_table_any_dev_attr() and
    elevate it for reuse to stop iterating (and return non-zero) on the
    first device that causes iterate_devices_callout_fn to return non-zero.
    Use dm_table_any_dev_attr() to properly iterate through devices.
    
    Rename device_is_nonrot() to device_is_rotational() and invert logic
    accordingly to fix improper disposition.
    
    [jeffle: backport notes]
    Also convert the no_sg_merge capability check, which is introduced by
    commit 200612ec ("dm table: propagate QUEUE_FLAG_NO_SG_MERGE"), and
    removed since commit 2705c937 ("block: kill QUEUE_FLAG_NO_SG_MERGE")
    in v5.1.
    
    Also convert the partial completion capability check, which is
    introduced by commit 22c11858 ("dm: introduce
    DM_TYPE_NVME_BIO_BASED"), and removed since commit 9c37de29 ("dm:
    remove special-casing of bio-based immutable singleton target on NVMe")
    in v5.10.
    
    Fixes: c3c4555e ("dm table: clear add_random unless all devices have it set")
    Fixes: 4693c966 ("dm table: propagate non rotational flag")
    Cc: stable@vger.kernel.org
    Signed-off-by: NJeffle Xu <jefflexu@linux.alibaba.com>
    Signed-off-by: NMike Snitzer <snitzer@redhat.com>
    Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
    Signed-off-by: NCheng Jian <cj.chengjian@huawei.com>
    a87da24e
dm-table.c 52.0 KB