Package: flashcache
Version: 3.1.3+git20150701-4
Severity: normal
Tags: patch
User: [email protected]
Usertags: origin-ubuntu yakkety ubuntu-patch

Dear Maintainer,

upstream changes in the 4.8 kernel broke the compile of the dkms module
for those. I created an update that fixes this (test compiled for 4.4
and 4.8). While looking at the logs I also fixed a small bug about
missing curly brackets and some unused variables.
I believe that since all functions only pass either READ or WRITE
without special flags, this change should be ok, though extra checking
never hurts.

-Stefan

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

  * Fix build error on Linux 4.8 (LP: #1625069)


Thanks for considering the patch.


-- System Information:
Debian Release: jessie/sid
  APT prefers trusty-updates
  APT policy: (500, 'trusty-updates'), (500, 'trusty-security'), (500, 
'trusty-proposed'), (500, 'trusty'), (100, 'trusty-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.13.0-96-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
diff -Nru flashcache-3.1.3+git20150701/debian/changelog flashcache-3.1.3+git20150701/debian/changelog
diff -Nru flashcache-3.1.3+git20150701/debian/patches/compat-4.8.patch flashcache-3.1.3+git20150701/debian/patches/compat-4.8.patch
--- flashcache-3.1.3+git20150701/debian/patches/compat-4.8.patch	1970-01-01 01:00:00.000000000 +0100
+++ flashcache-3.1.3+git20150701/debian/patches/compat-4.8.patch	2016-09-22 12:58:39.000000000 +0200
@@ -0,0 +1,121 @@
+Description: Fix FTBS on target systems running 4.8+ kernels
+ The bi_rw field was split into bi_op and bi_op_flags. Right now it looked
+ like the created IOs would be only plain READ or WRITE ones. If this ever
+ changes, then the whole call chain needs some update.
+ While looking at the source fix one warning and one potential bug of not
+ properly guarding an if section with { }.
+Author: Stefan Bader <[email protected]>
+
+Index: flashcache-3.1.3+git20150701/src/flashcache_ioctl.c
+===================================================================
+--- flashcache-3.1.3+git20150701.orig/src/flashcache_ioctl.c	2016-09-22 12:19:34.000000000 +0200
++++ flashcache-3.1.3+git20150701/src/flashcache_ioctl.c	2016-09-22 12:50:04.946286707 +0200
+@@ -541,7 +541,6 @@ flashcache_message(struct dm_target *ti,
+ 
+ 	/* Decode the sub-command. */
+ 	if (strcmp(argv[1], "add") == 0) {
+-		int rr;
+ 		if (argc != 3)
+ 			return -EINVAL;
+ 
+Index: flashcache-3.1.3+git20150701/src/flashcache_kcopy.c
+===================================================================
+--- flashcache-3.1.3+git20150701.orig/src/flashcache_kcopy.c	2015-07-02 01:09:43.000000000 +0200
++++ flashcache-3.1.3+git20150701/src/flashcache_kcopy.c	2016-09-22 12:50:04.962286707 +0200
+@@ -279,7 +279,11 @@ dm_io_async_pagelist_IO(struct flashcach
+ {
+ 	struct dm_io_request iorq;
+ 
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
+ 	iorq.bi_rw = rw;
++#else
++	iorq.bi_op = rw;
++#endif
+ 	iorq.mem.type = DM_IO_PAGE_LIST;
+ 	iorq.mem.ptr.pl = pl;
+ 	iorq.mem.offset = 0;
+Index: flashcache-3.1.3+git20150701/src/flashcache_main.c
+===================================================================
+--- flashcache-3.1.3+git20150701.orig/src/flashcache_main.c	2015-07-02 01:09:43.000000000 +0200
++++ flashcache-3.1.3+git20150701/src/flashcache_main.c	2016-09-22 12:50:04.962286707 +0200
+@@ -116,7 +116,11 @@ int dm_io_async_bvec_pl(unsigned int num
+ {
+ 	struct dm_io_request iorq;
+ 
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
+ 	iorq.bi_rw = rw;
++#else
++	iorq.bi_op = rw;
++#endif
+ 	iorq.mem.type = DM_IO_PAGE_LIST;
+ 	iorq.mem.ptr.pl = pl;
+ 	iorq.mem.offset = 0;
+@@ -140,7 +144,11 @@ int dm_io_async_bvec(unsigned int num_re
+ {
+ 	struct dm_io_request iorq;
+ 
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
+ 	iorq.bi_rw = rw;
++#else
++	iorq.bi_op = rw;
++#endif
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)
+ 	iorq.mem.type = DM_IO_BIO;
+ 	iorq.mem.ptr.bio = bio;	
+@@ -325,7 +333,7 @@ flashcache_io_callback(unsigned long err
+ 			}
+ 		} else {
+ 			dmc->flashcache_errors.ssd_write_errors++;
+-			if (dmc->cache_mode == FLASHCACHE_WRITE_THROUGH)
++			if (dmc->cache_mode == FLASHCACHE_WRITE_THROUGH) {
+ 				/* 
+ 				 * We don't know if the IO failed because of a ssd write
+ 				 * error or a disk write error. Bump up both.
+@@ -335,6 +343,7 @@ flashcache_io_callback(unsigned long err
+ 				 */
+ 			        disk_error = -EIO;
+ 				dmc->flashcache_errors.disk_write_errors++;
++			}
+ 		}
+ 		break;
+ 	}
+@@ -2052,7 +2061,11 @@ flashcache_write(struct cache_c *dmc, st
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)
+ #define bio_barrier(bio)        ((bio)->bi_rw & REQ_HARDBARRIER)
+ #else
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
+ #define bio_barrier(bio)        ((bio)->bi_rw & REQ_FLUSH)
++#else
++#define bio_barrier(bio)	((bio)->bi_opf & REQ_PREFLUSH)
++#endif
+ #endif
+ #endif
+ #endif
+Index: flashcache-3.1.3+git20150701/src/flashcache_subr.c
+===================================================================
+--- flashcache-3.1.3+git20150701.orig/src/flashcache_subr.c	2016-09-22 12:19:34.000000000 +0200
++++ flashcache-3.1.3+git20150701/src/flashcache_subr.c	2016-09-22 12:50:04.962286707 +0200
+@@ -848,7 +848,11 @@ flashcache_dm_io_async_vm(struct cache_c
+ 	unsigned long error_bits = 0;
+ 	int error;
+ 	struct dm_io_request io_req = {
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
+ 		.bi_rw = rw,
++#else
++		.bi_op = rw,
++#endif
+ 		.mem.type = DM_IO_VMA,
+ 		.mem.ptr.vma = data,
+ 		.mem.offset = 0,
+@@ -936,7 +940,11 @@ flashcache_dm_io_sync_vm(struct cache_c
+ 	unsigned long error_bits = 0;
+ 	int error;
+ 	struct dm_io_request io_req = {
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
+ 		.bi_rw = rw,
++#else
++		.bi_op = rw,
++#endif
+ 		.mem.type = DM_IO_VMA,
+ 		.mem.ptr.vma = data,
+ 		.mem.offset = 0,
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-04-07 18:03:10.000000000 +0200
+++ flashcache-3.1.3+git20150701/debian/patches/series	2016-09-22 12:48:38.000000000 +0200
@@ -2,3 +2,4 @@
 honor-cflags-and-ldflags.patch
 fix-build-error-on-linux-4.3.patch
 switch-from-ioctl-to-dm-target-messages.patch
+compat-4.8.patch

Reply via email to