[CentOS] NBD does not compile for 3.10.0-514.26.2.el7.x86_64

Mon Oct 30 15:11:30 UTC 2017
Phil Perry <pperry at elrepo.org>

On 30/10/17 14:19, Thanos Makatos wrote:
> Compiling NBD kernel module for kernel 3.10.0-514.26.2.el7.x86_64
> fails as follows:
> 
> # make -C ../../ M=`pwd` nbd.o
> make: Entering directory
> `/root/rpmbuild/BUILD/kernel-3.10.0-514.26.2.el7/linux-3.10.0-514.26.2.el7.x86_64'
>    CC      /root/rpmbuild/BUILD/kernel-3.10.0-514.26.2.el7/linux-3.10.0-514.26.2.el7.x86_64/drivers/block/nbd.o
> /root/rpmbuild/BUILD/kernel-3.10.0-514.26.2.el7/linux-3.10.0-514.26.2.el7.x86_64/drivers/block/nbd.c:
> In function ‘__nbd_ioctl’:
> /root/rpmbuild/BUILD/kernel-3.10.0-514.26.2.el7/linux-3.10.0-514.26.2.el7.x86_64/drivers/block/nbd.c:619:19:
> error: ‘REQ_TYPE_SPECIAL’ undeclared (first use in this function)
>     sreq.cmd_type = REQ_TYPE_SPECIAL;
>                     ^
> /root/rpmbuild/BUILD/kernel-3.10.0-514.26.2.el7/linux-3.10.0-514.26.2.el7.x86_64/drivers/block/nbd.c:619:19:
> note: each undeclared identifier is reported only once for each
> function it appears in
> make[1]: *** [/root/rpmbuild/BUILD/kernel-3.10.0-514.26.2.el7/linux-3.10.0-514.26.2.el7.x86_64/drivers/block/nbd.o]
> Error 1
> make: *** [nbd.o] Error 2
> make: Leaving directory
> `/root/rpmbuild/BUILD/kernel-3.10.0-514.26.2.el7/linux-3.10.0-514.26.2.el7.x86_64'
> 
> Was support for NBD dropped or was this just a human error?
> 

Because Red Hat do not configure and build this module, they do not 
maintain the code for it in their kernel.

REQ_TYPE_SPECIAL was renamed to REQ_TYPE_DRV_PRIV some time back, so try 
patching for that in nbd.c and rebuilding.

Be aware that by building the unmaintained module you will be missing 
all relevant security patches for this module since RHEL7 was first 
released some 3.5 years ago. A better solution would be to backport the 
module from the latest upstream kernel and maintain it out of tree.