A regression of cmd dev -d/-D noticed on some vmcores as:

    dev: invalid structure member offset: blk_mq_tag_set_shared_tags
         FILE: dev.c  LINE: 4468  FUNCTION: blk_mq_queue_tag_busy_iter()

    MAJOR GENDISK            NAME       REQUEST_QUEUE      TOTAL ASYNC  SYNC
    [crash] error trace: 91aa85 => 91a552 => 94d6ba => 94d647

      94d647: OFFSET_verify.part.0+55
      94d6ba: OFFSET_verify+42
      91a552: get_diskio_1+2194
      91aa85: display_all_diskio+1253

The root cause is, though upstream kernel have defined BLK_MQ_F_TAG_HCTX_SHARED
as (1 << 3), the value might be set different, e.g. [1]. So a single
blk_mq_is_shared_tags() check is not sufficient. This patch will add shared_tags
member check within blk_mq_tag_set struct as an enhancment.

[1]: 
https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-8/-/blob/c8s/include/linux/blk-mq.h?ref_type=heads#L321

Fixes: 62486400d35b ("Add blk_mq shared tags support for dev -d/-D")
Signed-off-by: Tao Liu <[email protected]>
---
 dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dev.c b/dev.c
index 8391d71..27318e8 100644
--- a/dev.c
+++ b/dev.c
@@ -4464,7 +4464,7 @@ static void blk_mq_queue_tag_busy_iter(ulong q, ulong 
*hctx, uint cnt,
        readmem(addr + OFFSET(blk_mq_tag_set_flags), KVADDR,
                &flags, sizeof(uint), "blk_mq_tag_set.flags", RETURN_ON_ERROR);
 
-       if (blk_mq_is_shared_tags(flags)) {
+       if (blk_mq_is_shared_tags(flags) && 
VALID_MEMBER(blk_mq_tag_set_shared_tags)) {
                addr = addr + OFFSET(blk_mq_tag_set_shared_tags);
                queue_for_each_hw_ctx(q, addr, bitmap_tags_is_ptr, dio);
                return;
-- 
2.47.0
--
Crash-utility mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://${domain_name}/admin/lists/devel.lists.crash-utility.osci.io/
Contribution Guidelines: https://github.com/crash-utility/crash/wiki

Reply via email to