Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

Linux 4.4 build failure. #215

Closed
vinsonlee opened this issue Nov 17, 2015 · 7 comments · Fixed by #216
Closed

Linux 4.4 build failure. #215

vinsonlee opened this issue Nov 17, 2015 · 7 comments · Fixed by #216

Comments

@vinsonlee
Copy link
Contributor

flashcache does not build with Linux 4.4.

CC [M] flashcache/src/flashcache_conf.o
flashcache/src/flashcache_conf.c:1718:2: error: unknown field ‘ioctl’ specified in initializer
.ioctl = flashcache_ioctl,
^

The build failure is introduced with Linux 4.4-rc1 commit e56f81e0b01ef4e45292d8c1e19edd4d09724e14 "dm: refactor ioctl handling".

commit e56f81e0b01ef4e45292d8c1e19edd4d09724e14
Author: Christoph Hellwig hch@lst.de
Date: Thu Oct 15 14:10:50 2015 +0200

dm: refactor ioctl handling

This moves the call to blkdev_ioctl and the argument checking to DM core
code, and only leaves a callout to find the block device to operate on
in the targets.  This simplifies the code and allows us to pass through
ioctl-like command using other methods in the next patch.

Also split out a helper around calling the prepare_ioctl method that
will be reused for persistent reservation handling.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
@foxcool
Copy link

foxcool commented Jan 23, 2016

/var/lib/dkms/flashcache/1.0-238-gca7a593606ea/build/flashcache_subr.c: В функции «flashcache_bio_endio»:
/var/lib/dkms/flashcache/1.0-238-gca7a593606ea/build/flashcache_subr.c:740:2: error: too many arguments for function «bio_endio»
bio_endio(bio, error);
^
In file included from include/linux/blkdev.h:18:0,
from /var/lib/dkms/flashcache/1.0-238-gca7a593606ea/build/flashcache_subr.c:29:
include/linux/bio.h:433:13: warning: declared here
extern void bio_endio(struct bio *);
^
scripts/Makefile.build:258: error «/var/lib/dkms/flashcache/1.0-238-gca7a593606ea/build/flashcache_subr.o»

@akiradeveloper
Copy link

it's due to the API change in 4.3

My driver fixed this problem as
akiradeveloper/dm-writeboost@eec4b59

I suppose flash cache can fix this issue too

  • Akira

On Sat, Jan 23, 2016 at 7:23 PM, Alexander Babenko <notifications@github.com

wrote:

/var/lib/dkms/flashcache/1.0-238-gca7a593606ea/build/flashcache_subr.c: В
функции «flashcache_bio_endio»:
/var/lib/dkms/flashcache/1.0-238-gca7a593606ea/build/flashcache_subr.c:740:2:
error: too many arguments for function «bio_endio»
bio_endio(bio, error);
^
In file included from include/linux/blkdev.h:18:0,
from
/var/lib/dkms/flashcache/1.0-238-gca7a593606ea/build/flashcache_subr.c:29:
include/linux/bio.h:433:13: warning: declared here
extern void bio_endio(struct bio *);
^
scripts/Makefile.build:258: error
«/var/lib/dkms/flashcache/1.0-238-gca7a593606ea/build/flashcache_subr.o»


Reply to this email directly or view it on GitHub
#215 (comment)
.

Akira Hayakawa

@awhitcroft
Copy link

I will note that the fix proposed here fixes the second simpler issue with flashcache against 4.4. The ioctl issue remains. A quick look at the change in the kernel implies they have removed the ioctl interface for DM devices, only allowing pass through of ioctls to disks underneath. That appears to preclude adding additional ioctls at the dm level.

@awhitcroft
Copy link

I did start an upstream conversation on this. They appear uninterested in this use case: https://lkml.org/lkml/2016/1/28/414

@awhitcroft
Copy link

Ok, we had some further discussion upstream about how this is "meant" to be done. It seems there is a target message system for this kind of thing, essentially an existing ioctl which can carry data to and from the target.

I attempted to convert the existing support over to this and have (frankly) bodged the existing user space tooling to use this via a call out to "dmsetup message". I am sure this is not the final form of the fix, but hope it at least sparks development in the right direction.

I have uploaded flashcache into Ubuntu with this change. I will also proposed a merge-request with this change.

awhitcroft pushed a commit to awhitcroft/flashcache that referenced this issue Feb 1, 2016
…anipulation

In mainline 4.4 the ioctl() callback in the DM target has been removed
in favour of a prepare_ioctl() which selects the underlying device,
all ioctls are assume to apply to that.  In discussions with upstream on
resolving this it was suggested that the correct mechanism for this
kind of target focussed ioctl is actually DM target messages.  This
patch converts the blacklist/whitelist manipulation over to these DM
target messages.

It also adds rather primative support to the flashcache_setioctl helper to
switch to DM target messages when the existing ioctls are not supported
(ENOTTY).  This is handled by calling out to dmsetup which offers a
message command to form these requests.

I would envisage it would be possible to reduce flashcache_setioctl to a
simple shell script in the future once there is no possibility of these
tools being used with a kernel supporting the ioctl only.

This should fix the hard parts of issue facebookarchive#215.

fixes: facebookarchive#215
Signed-off-by: Andy Whitcroft <apw@ubuntu.com>
@awhitcroft
Copy link

Well that did not quite work as expected. #216 is the pull request for the originally reported issue in this bug. The bio_end part is straight forward.

pubyun pushed a commit to pubyun/flashcache that referenced this issue Dec 21, 2016
…anipulation

In mainline 4.4 the ioctl() callback in the DM target has been removed
in favour of a prepare_ioctl() which selects the underlying device,
all ioctls are assume to apply to that.  In discussions with upstream on
resolving this it was suggested that the correct mechanism for this
kind of target focussed ioctl is actually DM target messages.  This
patch converts the blacklist/whitelist manipulation over to these DM
target messages.

It also adds rather primative support to the flashcache_setioctl helper to
switch to DM target messages when the existing ioctls are not supported
(ENOTTY).  This is handled by calling out to dmsetup which offers a
message command to form these requests.

I would envisage it would be possible to reduce flashcache_setioctl to a
simple shell script in the future once there is no possibility of these
tools being used with a kernel supporting the ioctl only.

This should fix the hard parts of issue facebookarchive#215.

fixes: facebookarchive#215
Signed-off-by: Andy Whitcroft <apw@ubuntu.com>
@demofly
Copy link

demofly commented Jan 2, 2017

Fixed for my Gentoo 4.4.39 in the next way:

git clone https://anonscm.debian.org/git/collab-maint/flashcache.git
cd flashcache
patch -p1 < debian/patches/usable-makefile.patch
patch -p1 < debian/patches/honor-cflags-and-ldflags.patch
patch -p1 < debian/patches/fix-build-error-on-linux-4.3.patch
patch -p1 < debian/patches/switch-from-ioctl-to-dm-target-messages.patch
make install KERNEL_TREE=/usr/src/linux-4.4.39-gentoo/

Then, disabled module signing control and rebuilt the kernel.

Works like a charm.

P.S. The code with patches are cloned from Debian upstream flashcache packages.

@jkkm jkkm closed this as completed in #216 Aug 29, 2017
qiuyi21 pushed a commit to qiuyi21/flashcache that referenced this issue Nov 28, 2017
…anipulation

In mainline 4.4 the ioctl() callback in the DM target has been removed
in favour of a prepare_ioctl() which selects the underlying device,
all ioctls are assume to apply to that.  In discussions with upstream on
resolving this it was suggested that the correct mechanism for this
kind of target focussed ioctl is actually DM target messages.  This
patch converts the blacklist/whitelist manipulation over to these DM
target messages.

It also adds rather primative support to the flashcache_setioctl helper to
switch to DM target messages when the existing ioctls are not supported
(ENOTTY).  This is handled by calling out to dmsetup which offers a
message command to form these requests.

I would envisage it would be possible to reduce flashcache_setioctl to a
simple shell script in the future once there is no possibility of these
tools being used with a kernel supporting the ioctl only.

This should fix the hard parts of issue facebookarchive#215.

fixes: facebookarchive#215
Signed-off-by: Andy Whitcroft <apw@ubuntu.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
5 participants