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

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