Blame SOURCES/0017-sbitmapq-Fix-for-kernels-without-struct-wait_queue_h.patch

1a20ba
From 6bc3b74c6e2b0aaebe1bc164594e53b010efef56 Mon Sep 17 00:00:00 2001
1a20ba
From: Kazuhito Hagio <k-hagio-ab@nec.com>
1a20ba
Date: Fri, 10 Jun 2022 15:52:34 +0900
1a20ba
Subject: [PATCH 17/18] sbitmapq: Fix for kernels without struct
1a20ba
 wait_queue_head
1a20ba
1a20ba
The current struct wait_queue_head was renamed by kernel commit
1a20ba
9d9d676f595b ("sched/wait: Standardize internal naming of wait-queue heads")
1a20ba
at Linux 4.13.  Without the patch, on earlier kernels the "sbitmapq"
1a20ba
command fails with the following error:
1a20ba
1a20ba
  crash> sbitmapq ffff8801790b3b50
1a20ba
  depth = 128
1a20ba
  busy = 0
1a20ba
  bits_per_word = 32
1a20ba
  ...
1a20ba
  sbitmapq: invalid structure member offset: wait_queue_head_head
1a20ba
            FILE: sbitmap.c  LINE: 344  FUNCTION: sbitmap_queue_show()
1a20ba
1a20ba
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
1a20ba
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
1a20ba
---
1a20ba
 sbitmap.c | 5 ++++-
1a20ba
 1 file changed, 4 insertions(+), 1 deletion(-)
1a20ba
1a20ba
diff --git a/sbitmap.c b/sbitmap.c
1a20ba
index bb2f19e6207b..be5d30a8ea88 100644
1a20ba
--- a/sbitmap.c
1a20ba
+++ b/sbitmap.c
1a20ba
@@ -341,7 +341,10 @@ static void sbitmap_queue_show(const struct sbitmap_queue_context *sqc,
1a20ba
 	sbq_wait_state_size = SIZE(sbq_wait_state);
1a20ba
 	wait_cnt_off = OFFSET(sbq_wait_state_wait_cnt);
1a20ba
 	wait_off = OFFSET(sbq_wait_state_wait);
1a20ba
-	list_head_off = OFFSET(wait_queue_head_head);
1a20ba
+	if (VALID_MEMBER(wait_queue_head_head)) /* 4.13 and later */
1a20ba
+		list_head_off = OFFSET(wait_queue_head_head);
1a20ba
+	else
1a20ba
+		list_head_off = OFFSET(__wait_queue_head_task_list);
1a20ba
 
1a20ba
 	sbq_wait_state_buf = GETBUF(sbq_wait_state_size);
1a20ba
 
1a20ba
-- 
1a20ba
2.30.2
1a20ba