Last active
April 17, 2018 08:18
-
-
Save hoonetorg/8cb2f71361ed9e6c8b4e1013bc4f0ee7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- drbd-kernel.spec.orig 2017-06-01 11:13:44.000000000 +0200 | |
+++ drbd-kernel.spec 2018-04-16 16:34:58.452833855 +0200 | |
@@ -4,6 +4,9 @@ Version: 8.4.10 | |
Release: 1%{?dist} | |
%global tarball_version %(echo "%{version}-%{?release}" | sed -e "s,%{?dist}$,,") | |
Source: http://oss.linbit.com/drbd/drbd-%{tarball_version}.tar.gz | |
+ | |
+Patch1: add-RHEL74-compat-hack.patch | |
+ | |
License: GPLv2+ | |
Group: System Environment/Kernel | |
URL: http://www.drbd.org/ | |
@@ -23,6 +26,8 @@ installed kernel. | |
%prep | |
%setup -q -n drbd-%{tarball_version} | |
+%patch1 -p1 | |
+ | |
%if %{defined suse_kernel_module_package} | |
# Support also sles10, where kernel_module_package was not yet defined. | |
# In sles11, suse_k_m_p became a wrapper around k_m_p. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/drbd/drbd_wrappers.h 2017-06-01 02:02:15.000000000 -0700 | |
+++ b/drbd/drbd_wrappers.h 2017-09-15 10:05:17.384320258 -0700 | |
@@ -824,7 +824,10 @@ static inline void blk_queue_write_cache | |
* bi_opf (some kernel version) -> data packet flags -> bi_opf (other kernel version) | |
*/ | |
-#ifdef COMPAT_HAVE_BIO_SET_OP_ATTRS | |
+#if defined(COMPAT_HAVE_BIO_SET_OP_ATTRS) && \ | |
+ !(defined(RHEL_RELEASE_CODE /* 7.4 broke our compat detection here */) && \ | |
+ LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)) | |
+ | |
/* Linux 4.8 split bio OPs and FLAGs {{{2 */ | |
#define DRBD_REQ_PREFLUSH REQ_PREFLUSH | |
@@ -995,9 +998,16 @@ static inline void blk_queue_write_cache | |
#endif | |
-#ifndef COMPAT_HAVE_BIO_SET_OP_ATTRS /* compat for Linux before 4.8 {{{2 */ | |
- | |
-#define bi_opf bi_rw | |
+#if defined(COMPAT_HAVE_BIO_SET_OP_ATTRS) /* compat for Linux before 4.8 {{{2 */ | |
+#if (defined(RHEL_RELEASE_CODE /* 7.4 broke our compat detection here */) && \ | |
+ LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)) | |
+/* Thank you RHEL 7.4 for backporting just enough to break existing compat code, | |
+ * but not enough to make it work for us without additional compat code. | |
+ */ | |
+#define COMPAT_NEED_BI_OPF_AND_SUBMIT_BIO_COMPAT_DEFINES 1 | |
+#endif | |
+#else /* !defined(COMPAT_HAVE_BIO_SET_OP_ATTRS) */ | |
+#define COMPAT_NEED_BI_OPF_AND_SUBMIT_BIO_COMPAT_DEFINES 1 | |
#ifndef REQ_WRITE | |
/* before 2.6.36 */ | |
@@ -1048,7 +1058,13 @@ static inline int op_from_rq_bits(u64 fl | |
else | |
return REQ_OP_READ; | |
} | |
+#endif | |
+ | |
+#ifdef COMPAT_NEED_BI_OPF_AND_SUBMIT_BIO_COMPAT_DEFINES | |
+#define bi_opf bi_rw | |
#define submit_bio(__bio) submit_bio(__bio->bi_rw, __bio) | |
+/* see comment in above compat enum req_op */ | |
+#define REQ_OP_FLUSH REQ_OP_WRITE | |
#endif | |
/* }}}1 bio -> bi_rw/bi_opf REQ_* and BIO_RW_* REQ_OP_* compat stuff */ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bd=`pwd` | |
KMOD_VER_8="8.4.10-1" | |
KMOD_VER_9="9.0.12-1" | |
UTILS_VER="9.3.0" | |
MANAGE_VER="0.99.16" | |
#drbd kernel modules | |
yum install kernel-abi-whitelists | |
# | |
mkdir -p `rpm -E "%_specdir"` `rpm -E "%_sourcedir"` | |
############################### | |
#drbd kernel module 8 | |
echo "drbd-kmod $KMOD_VER_8" >> $bd/`basename $0`.log | |
mkdir -p $bd/kmod8/rpms $bd/kmod8/rpmfiles | |
cd $bd/kmod8 | |
wget http://www.linbit.com/www.linbit.com/downloads/drbd/8.4/drbd-${KMOD_VER_8}.tar.gz | |
tar -xzf drbd-${KMOD_VER_8}.tar.gz | |
### !!! PATCH | |
cp $bd/add-RHEL74-compat-hack.patch `rpm -E "%_sourcedir"` | |
cp $bd/add-RHEL74-compat-hack-specfile.patch drbd-${KMOD_VER_8} | |
cd drbd-${KMOD_VER_8} | |
patch -p0 < add-RHEL74-compat-hack-specfile.patch | |
cd $bd/kmod8 | |
cd drbd-${KMOD_VER_8} | |
echo "drbd-kmod make kmp-rpm: begin" >> $bd/`basename $0`.log | |
make kmp-rpm 2>&1 |tee -a $bd/`basename $0`.log | |
echo "drbd-utils make kmp-rpm: end" >> $bd/`basename $0`.log | |
echo "drbd-utils make srpm: begin" >> $bd/`basename $0`.log | |
make srpm 2>&1 |tee -a $bd/`basename $0`.log | |
echo "drbd-utils make srpm: end" >> $bd/`basename $0`.log | |
echo find `rpm -E "%_rpmdir"` `rpm -E "%_srcrpmdir"` -type f -exec mv {} $bd/kmod8/rpms \; | |
find `rpm -E "%_rpmdir"` `rpm -E "%_srcrpmdir"` -type f -exec mv {} $bd/kmod8/rpms \; | |
echo find `rpm -E "%_specdir"` `rpm -E "%_sourcedir"` -type f -exec mv {} $bd/kmod8/rpmfiles \; | |
find `rpm -E "%_specdir"` `rpm -E "%_sourcedir"` -type f -exec mv {} $bd/kmod8/rpmfiles \; | |
############################### | |
#drbd kernel module 9 | |
echo "drbd-kmod $KMOD_VER_9" >> $bd/`basename $0`.log | |
mkdir -p $bd/kmod9/rpms $bd/kmod9/rpmfiles | |
cd $bd/kmod9 | |
wget http://www.linbit.com/www.linbit.com/downloads/drbd/9.0/drbd-${KMOD_VER_9}.tar.gz | |
tar -xzf drbd-${KMOD_VER_9}.tar.gz | |
### !!! PATCH | |
#cp $bd/add-RHEL74-compat-hack.patch `rpm -E "%_sourcedir"` | |
#cp $bd/add-RHEL74-compat-hack-specfile.patch drbd-${KMOD_VER_9} | |
#cd drbd-${KMOD_VER_9} | |
#patch -p0 < add-RHEL74-compat-hack-specfile.patch | |
#cd $bd/kmod9 | |
cd drbd-${KMOD_VER_9} | |
echo "drbd-kmod make kmp-rpm: begin" >> $bd/`basename $0`.log | |
make kmp-rpm 2>&1 |tee -a $bd/`basename $0`.log | |
echo "drbd-utils make kmp-rpm: end" >> $bd/`basename $0`.log | |
echo "drbd-utils make srpm: begin" >> $bd/`basename $0`.log | |
make srpm 2>&1 |tee -a $bd/`basename $0`.log | |
echo "drbd-utils make srpm: end" >> $bd/`basename $0`.log | |
echo find `rpm -E "%_rpmdir"` `rpm -E "%_srcrpmdir"` -type f -exec mv {} $bd/kmod9/rpms \; | |
find `rpm -E "%_rpmdir"` `rpm -E "%_srcrpmdir"` -type f -exec mv {} $bd/kmod9/rpms \; | |
echo find `rpm -E "%_specdir"` `rpm -E "%_sourcedir"` -type f -exec mv {} $bd/kmod9/rpmfiles \; | |
find `rpm -E "%_specdir"` `rpm -E "%_sourcedir"` -type f -exec mv {} $bd/kmod9/rpmfiles \; | |
############################### | |
#utils | |
echo "drbd-utils $UTILS_VER" >> $bd/`basename $0`.log | |
mkdir -p $bd/utils/rpms $bd/utils/rpmfiles | |
cd $bd/utils | |
wget http://www.linbit.com/downloads/drbd/utils/drbd-utils-${UTILS_VER}.tar.gz | |
tar -xzf drbd-utils-${UTILS_VER}.tar.gz | |
cd drbd-utils-${UTILS_VER} | |
echo "drbd-utils autogen.sh: begin" >> $bd/`basename $0`.log | |
./autogen.sh 2>&1 |tee -a $bd/`basename $0`.log | |
echo "drbd-utils autogen.sh: end" >> $bd/`basename $0`.log | |
echo "drbd-utils configure: begin" >> $bd/`basename $0`.log | |
./configure --enable-spec 2>&1 |tee -a $bd/`basename $0`.log | |
echo "drbd-utils configure: end" >> $bd/`basename $0`.log | |
cp drbd.spec ~/rpmbuild/SPECS | |
cd .. | |
cp drbd-utils-${UTILS_VER}.tar.gz ~/rpmbuild/SOURCES | |
cd ~/rpmbuild/SPECS | |
echo "drbd-utils rpmbuild begin:" >> $bd/`basename $0`.log | |
rpmbuild --without sbinsymlinks -ba drbd.spec 2>&1 |tee -a $bd/`basename $0`.log | |
echo "drbd-utils rpmbuild end:" >> $bd/`basename $0`.log | |
echo find `rpm -E "%_rpmdir"` `rpm -E "%_srcrpmdir"` -type f -exec mv {} $bd/utils/rpms \; | |
find `rpm -E "%_rpmdir"` `rpm -E "%_srcrpmdir"` -type f -exec mv {} $bd/utils/rpms \; | |
echo find `rpm -E "%_specdir"` `rpm -E "%_sourcedir"` -type f -exec mv {} $bd/utils/rpmfiles \; | |
find `rpm -E "%_specdir"` `rpm -E "%_sourcedir"` -type f -exec mv {} $bd/utils/rpmfiles \; | |
############################### | |
#drbdmanage | |
mkdir -p $bd/manage/rpms $bd/manage/rpmfiles | |
cd $bd/manage | |
wget http://www.linbit.com/downloads/drbdmanage/drbdmanage-${MANAGE_VER}.tar.gz | |
tar -xzf drbdmanage-${MANAGE_VER}.tar.gz | |
cd drbdmanage-${MANAGE_VER} | |
python setup.py bdist_rpm | |
mv dist/*.rpm $bd/manage/rpms | |
mv dist/* $bd/manage/rpmfiles |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment