bcc/bcc-0.20.0-Fix-mdflush-on-RHEL9.patch
Jerome Marchand 019ff871c7 Misc fixes (bz1992430)
- Sync with latest libbpf (fixes multiple BPF_F_BROADCAST breakages)
- Fix cpudist, mdflush, readahead, threadsnoop.
- Handle the renaming of task_struct_>state field on RHEL 9 (fixes
offcputime, offwaketime, runqlat and runqslower)
- Drop several tools that relies on features disabled on RHEL

Resolves: rhbz#1992430
Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
2021-10-15 10:57:36 +02:00

43 lines
1.7 KiB
Diff

From 8032bb4053ff8803371b038fc696b9fa682027f2 Mon Sep 17 00:00:00 2001
From: Jerome Marchand <jmarchan@redhat.com>
Date: Thu, 7 Oct 2021 17:31:53 +0200
Subject: [PATCH] Fix mdflush on RHEL9
Since kernel commit 309dca309fc ("block: store a block_device pointer
in struct bio") struct bio points again to a block_device and not to a
gendisk directly. However mdflush is looking at the presence or not of
the bio_dev macro to check whether to get the gendisk directly from
the bio or not, which doesn't work anymore since the bio_dev macro
still exists. Since we don't have to deal other ekrnel kernel version
but our own, just use the definition that we use in our kernels.
---
tools/mdflush.py | 11 -----------
1 file changed, 11 deletions(-)
diff --git a/tools/mdflush.py b/tools/mdflush.py
index 2abe15cf..df0f13c1 100755
--- a/tools/mdflush.py
+++ b/tools/mdflush.py
@@ -35,18 +35,7 @@ int kprobe__md_flush_request(struct pt_regs *ctx, void *mddev, struct bio *bio)
u32 pid = bpf_get_current_pid_tgid();
data.pid = pid;
bpf_get_current_comm(&data.comm, sizeof(data.comm));
-/*
- * The following deals with a kernel version change (in mainline 4.14, although
- * it may be backported to earlier kernels) with how the disk name is accessed.
- * We handle both pre- and post-change versions here. Please avoid kernel
- * version tests like this as much as possible: they inflate the code, test,
- * and maintenance burden.
- */
-#ifdef bio_dev
- struct gendisk *bi_disk = bio->bi_disk;
-#else
struct gendisk *bi_disk = bio->bi_bdev->bd_disk;
-#endif
bpf_probe_read_kernel(&data.disk, sizeof(data.disk), bi_disk->disk_name);
events.perf_submit(ctx, &data, sizeof(data));
return 0;
--
2.31.1