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

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