Rebuilt for latest kernel.

Related: RHEL-11426

Signed-off-by: Susan LeGendre-McGhee <slegendr@redhat.com>
This commit is contained in:
Susan LeGendre-McGhee 2023-10-07 03:38:42 +00:00
parent 3c4ee376dc
commit 2078f65024
2 changed files with 125 additions and 2 deletions

View File

@ -0,0 +1,113 @@
diff -Naur kvdo-c9bd224d9c48b35f3db202e648c3abaece81f39e.orig/vdo/io-factory.c kvdo-c9bd224d9c48b35f3db202e648c3abaece81f39e/vdo/io-factory.c
--- kvdo-c9bd224d9c48b35f3db202e648c3abaece81f39e.orig/vdo/io-factory.c 2023-10-06 22:41:55.624013630 -0400
+++ kvdo-c9bd224d9c48b35f3db202e648c3abaece81f39e/vdo/io-factory.c 2023-10-06 23:03:22.482013630 -0400
@@ -6,10 +6,27 @@
#include <linux/atomic.h>
#include <linux/blkdev.h>
#include <linux/mount.h>
+#ifndef VDO_UPSTREAM
+#include <linux/version.h>
+#endif /* VDO_UPSTREAM */
#include "io-factory.h"
#include "logger.h"
#include "memory-alloc.h"
+#ifndef VDO_UPSTREAM
+#undef VDO_USE_ALTERNATE
+#ifdef RHEL_RELEASE_CODE
+#if (RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(9, 4))
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6,5,0))
+#define VDO_USE_ALTERNATE
+#endif
+#endif
+#else /* !RHEL_RELEASE_CODE */
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6,5,0))
+#define VDO_USE_ALTERNATE
+#endif
+#endif /* !RHEL_RELEASE_CODE */
+#endif /* !VDO_UPSTREAM */
enum { BLK_FMODE = FMODE_READ | FMODE_WRITE };
@@ -30,16 +47,38 @@
static int get_block_device_from_name(const char *name,
struct block_device **bdev)
{
- dev_t device = name_to_dev_t(name);
-
- if (device != 0) {
+ dev_t device;
+ unsigned int major, minor;
+ char dummy;
+#ifndef VDO_USE_ALTERNATE
+ const struct blk_holder_ops hops = { NULL };
+#endif /* !VDO_USE_ALTERNATE */
+
+ /* Extract the major/minor numbers */
+ if (sscanf(name, "%u:%u%c", &major, &minor, &dummy) == 2) {
+ device = MKDEV(major, minor);
+ if (MAJOR(device) != major || MINOR(device) != minor) {
+ *bdev = NULL;
+ return uds_log_error_strerror(UDS_INVALID_ARGUMENT,
+ "%s is not a valid block device",
+ name);
+ }
+#ifdef VDO_USE_ALTERNATE
*bdev = blkdev_get_by_dev(device, BLK_FMODE, NULL);
+#else
+ *bdev = blkdev_get_by_dev(device, BLK_FMODE, NULL, &hops);
+#endif /* VDO_USE_ALTERNATE */
} else {
+#ifdef VDO_USE_ALTERNATE
*bdev = blkdev_get_by_path(name, BLK_FMODE, NULL);
+#else
+ *bdev = blkdev_get_by_path(name, BLK_FMODE, NULL, &hops);
+#endif /* VDO_USE_ALTERNATE */
}
+
if (IS_ERR(*bdev)) {
- uds_log_error_strerror(-PTR_ERR(*bdev),
- "%s is not a block device", name);
+ uds_log_error_strerror(-PTR_ERR(*bdev), "%s is not a block device", name);
+ *bdev = NULL;
return UDS_INVALID_ARGUMENT;
}
@@ -59,7 +98,11 @@
result = UDS_ALLOCATE(1, struct io_factory, __func__, &factory);
if (result != UDS_SUCCESS) {
+#ifdef VDO_USE_ALTERNATE
blkdev_put(bdev, BLK_FMODE);
+#else
+ blkdev_put(bdev, NULL);
+#endif /* VDO_USE_ALTERNATE */
return result;
}
@@ -80,7 +123,11 @@
return result;
}
+#ifdef VDO_USE_ALTERNATE
blkdev_put(factory->bdev, BLK_FMODE);
+#else
+ blkdev_put(factory->bdev, NULL);
+#endif /* VDO_USE_ALTERNATE */
factory->bdev = bdev;
return UDS_SUCCESS;
}
@@ -88,7 +135,11 @@
void put_uds_io_factory(struct io_factory *factory)
{
if (atomic_add_return(-1, &factory->ref_count) <= 0) {
- blkdev_put(factory->bdev, BLK_FMODE);
+#ifdef VDO_USE_ALTERNATE
+ blkdev_put(factory->bdev, BLK_FMODE);
+#else
+ blkdev_put(factory->bdev, NULL);
+#endif /* VDO_USE_ALTERNATE */
UDS_FREE(factory);
}
}

View File

@ -1,12 +1,12 @@
%global commit c9bd224d9c48b35f3db202e648c3abaece81f39e
%global gittag 8.2.1.6
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%define spec_release 98
%define spec_release 99
%define kmod_name kvdo
%define kmod_driver_version %{gittag}
%define kmod_rpm_release %{spec_release}
%define kmod_kernel_version 5.14.0-360.el9
%define kmod_kernel_version 5.14.0-373.el9
%define kmod_headers_version %(rpm -qa kernel-devel | sed 's/^kernel-devel-//')
%define kmod_kbuild_dir .
%define kmod_devel_package 0
@ -14,6 +14,7 @@
Source0: https://github.com/dm-vdo/%{kmod_name}/archive/%{commit}/%{kmod_name}-%{shortcommit}.tar.gz
Patch0: add_lz4_dependency.patch
Patch1: removed-logical-space-check-from-table-line.patch
Patch2: adapt_backported_kernel65.patch
%define findpat %( echo "%""P" )
@ -107,6 +108,7 @@ printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --dracut=/usr/bin/dracu
%setup -n %{kmod_name}-%{commit}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%{nil}
set -- *
mkdir source
@ -155,6 +157,14 @@ install -m 644 -D source/greylist.txt $RPM_BUILD_ROOT/usr/share/doc/kmod-%{kmod_
rm -rf $RPM_BUILD_ROOT
%changelog
* Fri Oct 06 2023 - Susan LeGendre-McGhee <slegendr@redhat.com> - 8.2.1.6-99.el9
- Added temporary patch file to correct build failures regarding io-factory.c
- Related: RHEL-11426
* Fri Oct 06 2023 - Susan LeGendre-McGhee <slegendr@redhat.com> - 8.2.1.6-99.el9
- Rebuilt for latest kernel.
- Related: RHEL-11426
* Thu Aug 24 2023 - Susan LeGendre-McGhee <slegendr@redhat.com> - 8.2.1.6-98.el9
- Rebuilt for latest kernel.
- Related: rhbz#2172911