]> sourceware.org Git - systemtap.git/commitdiff
Fix PR22036 by handling "struct bio" kernel changes.
authorDavid Smith <dsmith@redhat.com>
Tue, 29 Aug 2017 21:27:23 +0000 (16:27 -0500)
committerDavid Smith <dsmith@redhat.com>
Tue, 29 Aug 2017 21:27:23 +0000 (16:27 -0500)
* buildrun.cxx (compile_pass): Add "autoconf"-style test for bi_opf field
  of the "bio" structure.
* runtime/linux/autoconf-bio-bi_opf.c: New file.
* tapset/linux/ioblock.stp (bio_op): Use new STAPCONF_BIO_BI_OPF define.

buildrun.cxx
runtime/linux/autoconf-bio-bi_opf.c [new file with mode: 0644]
tapset/linux/ioblock.stp

index 53643e2ddf13ae6938a68df2f0c522f174eb2725..dd07593444c2b7427f09ca8a9fe306d460fc1485 100644 (file)
@@ -463,6 +463,7 @@ compile_pass (systemtap_session& s)
                  "STAPCONF_GET_USER_PAGES_REMOTE_FLAGS_LOCKED", NULL);
   output_autoconf(s, o, "autoconf-uapi-linux-sched-types.c",
                  "STAPCONF_UAPI_LINUX_SCHED_TYPES", NULL);
+  output_autoconf(s, o, "autoconf-bio-bi_opf.c", "STAPCONF_BIO_BI_OPF", NULL);
 
   // used by runtime/linux/netfilter.c
   output_exportconf(s, o, "nf_register_hook", "STAPCONF_NF_REGISTER_HOOK");
diff --git a/runtime/linux/autoconf-bio-bi_opf.c b/runtime/linux/autoconf-bio-bi_opf.c
new file mode 100644 (file)
index 0000000..20db781
--- /dev/null
@@ -0,0 +1,27 @@
+#include <linux/bio.h>
+
+/*
+ * Handle the following kernel commit:
+ *
+ *   commit 1eff9d322a444245c67515edb52bc0eb68374aa8
+ *   Author: Jens Axboe <axboe@fb.com>
+ *   Date:   Fri Aug 5 15:35:16 2016 -0600
+ *   
+ *       block: rename bio bi_rw to bi_opf
+ *       
+ *       Since commit 63a4cc24867d, bio->bi_rw contains flags in the lower
+ *       portion and the op code in the higher portions. This means that
+ *       old code that relies on manually setting bi_rw is most likely
+ *       going to be broken. Instead of letting that brokeness linger,
+ *       rename the member, to force old and out-of-tree code to break
+ *       at compile time instead of at runtime.
+ *       
+ *       No intended functional changes in this commit.
+ */
+
+void bar (void)
+{
+        struct bio foo;
+       foo.bi_opf = 0;
+        (void) foo;
+}
index 317a990930e45366c7e13c74b9b5f0b6df0762d9..e6798fc6dbfeea54a42c968dd7a4a805080bc2b0 100644 (file)
@@ -19,7 +19,7 @@
 /* Returns the REQ_OP_* bits for a bio structure. */
 function bio_op:long(bio:long)
 %{ /* pure */ /* unprivileged */
-#if defined(bio_op)
+#if defined(STAPCONF_BIO_BI_OPF)
     struct bio *bio = (struct bio *)(uintptr_t)STAP_ARG_bio;
 
     STAP_RETVALUE = 0;
This page took 0.70202 seconds and 5 git commands to generate.