Blame SOURCES/bcc-0.20.0-Fix-mdflush-on-RHEL9.patch

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