Package: flashcache
Version: 3.1.3+git20150701-5
Severity: important
Tags: patch
User: [email protected]
Usertags: origin-ubuntu artful ubuntu-patch

Dear Maintainer,

unfortunately when fixing the compile for 4.8 (up to 4.12) kernels
I missed that for some cases it is required to initialize the
bi_op_flags field of dm_io_request structures to 0. I suspect the
way the request is created in src/flashcache_subr.c would be ok
without but for clarity and safety I added this in all cases.
Not doing so lead to IOs being not written back to the backing device.
This makes the driver completely unusable on those newer kernels.

The supplied patch (might be merged into the compat-4.8 patch or
kept seperate) is fixing this. By now I found a way of verifying
the module functionality without need of additional disks.


*** /tmp/tmpimJRws/bug_body

In Ubuntu, the attached patch was applied to achieve the following:

Fix flashcache-dkms to produce a module with 4.8..4.12 kernels which is
again usable and and writes data back to the backing device.
Without this the logical volume which is created can be written to but
all data is lost.

  * Initialize bi_op_flags in dm_io_request structures (LP: #1714185).


Thanks for considering the patch.


-- System Information:
Debian Release: stretch/sid
  APT prefers xenial-updates
  APT policy: (500, 'xenial-updates'), (500, 'xenial-security'), (500, 'xenial')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.4.0-93-generic (SMP w/8 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
diff -Nru flashcache-3.1.3+git20150701/debian/patches/init-bi-op-flags.patch flashcache-3.1.3+git20150701/debian/patches/init-bi-op-flags.patch
--- flashcache-3.1.3+git20150701/debian/patches/init-bi-op-flags.patch	1970-01-01 01:00:00.000000000 +0100
+++ flashcache-3.1.3+git20150701/debian/patches/init-bi-op-flags.patch	2017-08-30 17:05:30.000000000 +0200
@@ -0,0 +1,47 @@
+Description: Initialize bi_op_flags elements
+ When converting to use bi_op/bi_opf we must explicitly set bi_op_flags
+ in the dm_io_request structures. Otherwise it might contain garbage
+ that can cause bad results.
+Author: Stefan Bader <[email protected]>
+Forwarded: No
+
+Index: flashcache-3.1.3+git20150701/src/flashcache_main.c
+===================================================================
+--- flashcache-3.1.3+git20150701.orig/src/flashcache_main.c
++++ flashcache-3.1.3+git20150701/src/flashcache_main.c
+@@ -120,6 +120,7 @@ int dm_io_async_bvec_pl(unsigned int num
+ 	iorq.bi_rw = rw;
+ #else
+ 	iorq.bi_op = rw;
++	iorq.bi_op_flags = 0;
+ #endif
+ 	iorq.mem.type = DM_IO_PAGE_LIST;
+ 	iorq.mem.ptr.pl = pl;
+@@ -148,6 +149,7 @@ int dm_io_async_bvec(unsigned int num_re
+ 	iorq.bi_rw = rw;
+ #else
+ 	iorq.bi_op = rw;
++	iorq.bi_op_flags = 0;
+ #endif
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)
+ 	iorq.mem.type = DM_IO_BIO;
+Index: flashcache-3.1.3+git20150701/src/flashcache_subr.c
+===================================================================
+--- flashcache-3.1.3+git20150701.orig/src/flashcache_subr.c
++++ flashcache-3.1.3+git20150701/src/flashcache_subr.c
+@@ -852,6 +852,7 @@ flashcache_dm_io_async_vm(struct cache_c
+ 		.bi_rw = rw,
+ #else
+ 		.bi_op = rw,
++		.bi_op_flags = 0,
+ #endif
+ 		.mem.type = DM_IO_VMA,
+ 		.mem.ptr.vma = data,
+@@ -944,6 +945,7 @@ flashcache_dm_io_sync_vm(struct cache_c
+ 		.bi_rw = rw,
+ #else
+ 		.bi_op = rw,
++		.bi_op_flags = 0,
+ #endif
+ 		.mem.type = DM_IO_VMA,
+ 		.mem.ptr.vma = data,
diff -Nru flashcache-3.1.3+git20150701/debian/patches/series flashcache-3.1.3+git20150701/debian/patches/series
--- flashcache-3.1.3+git20150701/debian/patches/series	2016-12-03 11:37:14.000000000 +0100
+++ flashcache-3.1.3+git20150701/debian/patches/series	2017-08-31 10:22:16.000000000 +0200
@@ -3,3 +3,4 @@
 fix-build-error-on-linux-4.3.patch
 switch-from-ioctl-to-dm-target-messages.patch
 compat-4.8.patch
+init-bi-op-flags.patch

Reply via email to