Updated to version 8.1.1.287

- Eliminated uses of "master" as part of the conscious language initiative.
- Resolves: rhbz#2023970
- Fixed potential use-after-free error found by Coverity.
- Resolves: rhbz#1999056
- Fixed bug which could result in empty flushes being issued to the storage
  below vdo while suspended.
- Resolves: rhbz#2013057
- Added optional table line parameters for enabling or disabling
  deduplication and compression.
- Resolves: rhbz#2007444
- Adapted to kernel API changes.
- Resolves: rhbz#2035003
This commit is contained in:
Andrew Walsh 2022-01-24 02:51:10 +00:00
parent 2b57ade9c7
commit 67d50f14c5
6 changed files with 19 additions and 418 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@
/kvdo-2e1a578.tar.gz
/kvdo-000a4c2.tar.gz
/kvdo-3f9bde5.tar.gz
/kvdo-f9d6d18.tar.gz

View File

@ -1,58 +0,0 @@
From 1dfccb284d3eb487028adc9006afb9ba0869e687 Mon Sep 17 00:00:00 2001
From: Joseph Chapman <jochapma@redhat.com>
Date: Thu, 23 Dec 2021 09:05:15 -0500
Subject: [PATCH] Eliminate use of bvec_kmap_irq
Signed-off-by: Joseph Chapman <jochapma@redhat.com>
---
vdo/bio.c | 25 ++++++++-----------------
1 file changed, 8 insertions(+), 17 deletions(-)
diff --git a/vdo/bio.c b/vdo/bio.c
index 70f7a7d0..8234c7ed 100644
--- a/vdo/bio.c
+++ b/vdo/bio.c
@@ -40,15 +40,11 @@ void vdo_bio_copy_data_in(struct bio *bio, char *data_ptr)
{
struct bio_vec biovec;
struct bvec_iter iter;
- unsigned long flags;
- bio_for_each_segment(biovec, bio, iter) {
- void *from = bvec_kmap_irq(&biovec, &flags);
-
- memcpy(data_ptr, from, biovec.bv_len);
- data_ptr += biovec.bv_len;
- bvec_kunmap_irq(from, &flags);
- }
+ bio_for_each_segment(biovec, bio, iter) {
+ memcpy_from_bvec(data_ptr, &biovec);
+ data_ptr += biovec.bv_len;
+ }
}
/**********************************************************************/
@@ -56,16 +52,11 @@ void vdo_bio_copy_data_out(struct bio *bio, char *data_ptr)
{
struct bio_vec biovec;
struct bvec_iter iter;
- unsigned long flags;
- bio_for_each_segment(biovec, bio, iter) {
- void *dest = bvec_kmap_irq(&biovec, &flags);
-
- memcpy(dest, data_ptr, biovec.bv_len);
- data_ptr += biovec.bv_len;
- flush_dcache_page(biovec.bv_page);
- bvec_kunmap_irq(dest, &flags);
- }
+ bio_for_each_segment(biovec, bio, iter) {
+ memcpy_to_bvec(&biovec, data_ptr);
+ data_ptr += biovec.bv_len;
+ }
}
/**********************************************************************/
--
2.31.1

View File

@ -1,82 +0,0 @@
From 4b31b2a3e9ff5ee92d2204a5c0850d329945121b Mon Sep 17 00:00:00 2001
From: Andrew Walsh <awalsh@redhat.com>
Date: Thu, 23 Dec 2021 19:05:01 -0500
Subject: [PATCH] Removed usage of removed elevator constants.
---
vdo/ioSubmitter.c | 27 ++++++++-------------------
1 file changed, 8 insertions(+), 19 deletions(-)
diff --git a/vdo/ioSubmitter.c b/vdo/ioSubmitter.c
index b4e571ab..a0628992 100644
--- a/vdo/ioSubmitter.c
+++ b/vdo/ioSubmitter.c
@@ -305,25 +305,22 @@ static void process_bio_map(struct vdo_work_item *item)
*
* @param map The bio map to use for merging
* @param vio The vio we want to merge
- * @param merge_type The type of merging we want to try
+ * @param back_merge Set to true for a back merge, false for a front merge
*
* @return the vio to merge to, NULL if no merging is possible
*/
static struct vio *get_mergeable_locked(struct int_map *map,
struct vio *vio,
- unsigned int merge_type)
+ bool back_merge)
{
struct bio *bio = vio->bio;
sector_t merge_sector = get_bio_sector(bio);
struct vio *vio_merge;
- switch (merge_type) {
- case ELEVATOR_BACK_MERGE:
+ if (back_merge) {
merge_sector -= VDO_SECTORS_PER_BLOCK;
- break;
- case ELEVATOR_FRONT_MERGE:
+ } else {
merge_sector += VDO_SECTORS_PER_BLOCK;
- break;
}
vio_merge = int_map_get(map, merge_sector);
@@ -345,20 +342,14 @@ static struct vio *get_mergeable_locked(struct int_map *map,
return NULL;
}
- switch (merge_type) {
- case ELEVATOR_BACK_MERGE:
+ if (back_merge) {
if (get_bio_sector(vio_merge->bios_merged.tail) !=
merge_sector) {
return NULL;
}
- break;
-
- case ELEVATOR_FRONT_MERGE:
- if (get_bio_sector(vio_merge->bios_merged.head) !=
+ } else if (get_bio_sector(vio_merge->bios_merged.head) !=
merge_sector) {
return NULL;
- }
- break;
}
return vio_merge;
@@ -422,10 +413,8 @@ static bool try_bio_map_merge(struct bio_queue_data *bio_queue_data,
struct vio *prev_vio, *next_vio;
mutex_lock(&bio_queue_data->lock);
- prev_vio = get_mergeable_locked(bio_queue_data->map, vio,
- ELEVATOR_BACK_MERGE);
- next_vio = get_mergeable_locked(bio_queue_data->map, vio,
- ELEVATOR_FRONT_MERGE);
+ prev_vio = get_mergeable_locked(bio_queue_data->map, vio, true);
+ next_vio = get_mergeable_locked(bio_queue_data->map, vio, false);
if (prev_vio == next_vio) {
next_vio = NULL;
}
--
2.31.1

View File

@ -1,268 +0,0 @@
diff -Naur kvdo-3f9bde55d3d6bd6083af31a11eb2ac066904f581.orig/vdo/dedupeIndex.c kvdo-3f9bde55d3d6bd6083af31a11eb2ac066904f581/vdo/dedupeIndex.c
--- kvdo-3f9bde55d3d6bd6083af31a11eb2ac066904f581.orig/vdo/dedupeIndex.c 2021-08-09 16:38:48.000000000 -0400
+++ kvdo-3f9bde55d3d6bd6083af31a11eb2ac066904f581/vdo/dedupeIndex.c 2022-01-04 17:04:39.219875889 -0500
@@ -768,7 +768,10 @@
del_timer_sync(&index->pending_timer);
}
spin_unlock_bh(&index->pending_lock);
- kobject_put(&index->dedupe_directory);
+
+ uds_free_configuration(index->configuration);
+ UDS_FREE(index->index_name);
+ UDS_FREE(index);
}
/**********************************************************************/
@@ -901,7 +904,7 @@
NULL,
};
-static struct kobj_type dedupe_directory_type = {
+static __always_unused struct kobj_type dedupe_directory_type = {
.release = dedupe_kobj_release,
.sysfs_ops = &dedupe_sysfs_ops,
.default_attrs = dedupe_attributes,
@@ -1005,19 +1008,6 @@
uds_destroy_index_session(index->index_session);
uds_free_configuration(index->configuration);
UDS_FREE(index->index_name);
- UDS_FREE(index);
- return result;
- }
-
- kobject_init(&index->dedupe_directory, &dedupe_directory_type);
- result = kobject_add(&index->dedupe_directory,
- &vdo->vdo_directory,
- "dedupe");
- if (result != VDO_SUCCESS) {
- free_work_queue(UDS_FORGET(index->uds_queue));
- uds_destroy_index_session(index->index_session);
- uds_free_configuration(index->configuration);
- UDS_FREE(index->index_name);
UDS_FREE(index);
return result;
}
diff -Naur kvdo-3f9bde55d3d6bd6083af31a11eb2ac066904f581.orig/vdo/histogram.c kvdo-3f9bde55d3d6bd6083af31a11eb2ac066904f581/vdo/histogram.c
--- kvdo-3f9bde55d3d6bd6083af31a11eb2ac066904f581.orig/vdo/histogram.c 2021-08-09 16:38:48.000000000 -0400
+++ kvdo-3f9bde55d3d6bd6083af31a11eb2ac066904f581/vdo/histogram.c 2022-01-04 17:06:10.761875889 -0500
@@ -620,7 +620,7 @@
NULL,
};
-static struct kobj_type histogram_kobj_type = {
+static __always_unused struct kobj_type histogram_kobj_type = {
.release = histogram_kobj_release,
.sysfs_ops = &histogram_sysfs_ops,
.default_attrs = histogram_attributes,
@@ -636,7 +636,7 @@
NULL,
};
-static struct kobj_type bucketless_histogram_kobj_type = {
+static __always_unused struct kobj_type bucketless_histogram_kobj_type = {
.release = histogram_kobj_release,
.sysfs_ops = &histogram_sysfs_ops,
.default_attrs = bucketless_histogram_attributes,
@@ -689,13 +689,6 @@
return NULL;
}
- kobject_init(&h->kobj,
- ((num_buckets > 0) ? &histogram_kobj_type :
- &bucketless_histogram_kobj_type));
- if (kobject_add(&h->kobj, parent, name) != 0) {
- histogram_kobj_release(&h->kobj);
- return NULL;
- }
return h;
}
@@ -876,6 +869,7 @@
void free_histogram(struct histogram *histogram)
{
if (histogram != NULL) {
- kobject_put(&histogram->kobj);
+ UDS_FREE(histogram->counters);
+ UDS_FREE(histogram);
}
}
diff -Naur kvdo-3f9bde55d3d6bd6083af31a11eb2ac066904f581.orig/vdo/kernelLayer.c kvdo-3f9bde55d3d6bd6083af31a11eb2ac066904f581/vdo/kernelLayer.c
--- kvdo-3f9bde55d3d6bd6083af31a11eb2ac066904f581.orig/vdo/kernelLayer.c 2021-08-09 16:38:48.000000000 -0400
+++ kvdo-3f9bde55d3d6bd6083af31a11eb2ac066904f581/vdo/kernelLayer.c 2022-01-04 17:07:18.228875889 -0500
@@ -620,7 +620,7 @@
/**********************************************************************/
int start_kernel_layer(struct kernel_layer *layer, char **reason)
{
- static struct kobj_type stats_directory_type = {
+ static __always_unused struct kobj_type stats_directory_type = {
.release = pool_stats_release,
.sysfs_ops = &vdo_pool_stats_sysfs_ops,
.default_attrs = vdo_pool_stats_attrs,
@@ -644,16 +644,6 @@
}
set_kernel_layer_state(layer, LAYER_RUNNING);
- kobject_init(&layer->vdo.stats_directory, &stats_directory_type);
- result = kobject_add(&layer->vdo.stats_directory,
- &layer->vdo.vdo_directory,
- "statistics");
- if (result != 0) {
- *reason = "Cannot add sysfs statistics node";
- stop_kernel_layer(layer);
- return result;
- }
- layer->vdo.stats_added = true;
if (layer->vdo.device_config->deduplication) {
// Don't try to load or rebuild the index first (and log
@@ -672,15 +662,6 @@
{
layer->vdo.allocations_allowed = true;
- // Stop services that need to gather VDO statistics from the worker
- // threads.
- if (layer->vdo.stats_added) {
- layer->vdo.stats_added = false;
- init_completion(&layer->vdo.stats_shutdown);
- kobject_put(&layer->vdo.stats_directory);
- wait_for_completion(&layer->vdo.stats_shutdown);
- }
-
switch (get_kernel_layer_state(layer)) {
case LAYER_RUNNING:
suspend_kernel_layer(layer);
diff -Naur kvdo-3f9bde55d3d6bd6083af31a11eb2ac066904f581.orig/vdo/vdo.c kvdo-3f9bde55d3d6bd6083af31a11eb2ac066904f581/vdo/vdo.c
--- kvdo-3f9bde55d3d6bd6083af31a11eb2ac066904f581.orig/vdo/vdo.c 2021-08-09 16:38:48.000000000 -0400
+++ kvdo-3f9bde55d3d6bd6083af31a11eb2ac066904f581/vdo/vdo.c 2022-01-04 16:48:44.637875889 -0500
@@ -145,13 +145,7 @@
* reference count; when the count goes to zero the VDO object will be
* freed as a side effect.
*/
- if (get_vdo_admin_state_code(&vdo->admin_state)
- == VDO_ADMIN_STATE_NEW) {
- UDS_FREE(vdo);
- } else {
- kobject_put(&vdo->work_queue_directory);
- kobject_put(&vdo->vdo_directory);
- }
+ UDS_FREE(vdo);
}
/**********************************************************************/
diff -Naur kvdo-3f9bde55d3d6bd6083af31a11eb2ac066904f581.orig/vdo/vdoInit.c kvdo-3f9bde55d3d6bd6083af31a11eb2ac066904f581/vdo/vdoInit.c
--- kvdo-3f9bde55d3d6bd6083af31a11eb2ac066904f581.orig/vdo/vdoInit.c 2021-08-09 16:38:48.000000000 -0400
+++ kvdo-3f9bde55d3d6bd6083af31a11eb2ac066904f581/vdo/vdoInit.c 2022-01-04 17:01:49.735875889 -0500
@@ -56,37 +56,13 @@
* @return VDO_SUCCESS or an error code
**/
static int initialize_vdo_kobjects(struct vdo *vdo,
- struct dm_target *target,
- char **reason)
+ struct dm_target *target __always_unused,
+ char **reason __always_unused)
{
- int result;
- struct mapped_device *md = dm_table_get_md(target->table);
- kobject_init(&vdo->vdo_directory, &vdo_directory_type);
- result = kobject_add(&vdo->vdo_directory,
- &disk_to_dev(dm_disk(md))->kobj,
- "vdo");
- if (result != 0) {
- destroy_vdo(vdo);
- kobject_put(&vdo->vdo_directory);
- *reason = "Cannot add sysfs node";
- return result;
- }
-
// Indicate that kobject_put() should now be called on the vdo
// directory in order to free the vdo rather than doing so directly.
set_vdo_admin_state_code(&vdo->admin_state,
VDO_ADMIN_STATE_INITIALIZED);
- kobject_init(&vdo->work_queue_directory,
- &vdo_work_queue_directory_type);
- result = kobject_add(&vdo->work_queue_directory,
- &vdo->vdo_directory,
- "work_queues");
- if (result != 0) {
- *reason = "Cannot add sysfs node";
- destroy_vdo(vdo);
- return result;
- }
-
return VDO_SUCCESS;
}
diff -Naur kvdo-3f9bde55d3d6bd6083af31a11eb2ac066904f581.orig/vdo/workQueue.c kvdo-3f9bde55d3d6bd6083af31a11eb2ac066904f581/vdo/workQueue.c
--- kvdo-3f9bde55d3d6bd6083af31a11eb2ac066904f581.orig/vdo/workQueue.c 2021-08-09 16:38:48.000000000 -0400
+++ kvdo-3f9bde55d3d6bd6083af31a11eb2ac066904f581/vdo/workQueue.c 2022-01-04 17:51:24.439875889 -0500
@@ -436,8 +436,6 @@
struct simple_work_queue *queue = ptr;
unsigned long flags;
- kobject_get(&queue->common.kobj);
-
queue->stats.start_time = queue->most_recent_wakeup = ktime_get_ns();
spin_lock_irqsave(&queue->lock, flags);
@@ -447,7 +445,6 @@
wake_up(&queue->start_waiters);
service_work_queue(queue);
- kobject_put(&queue->common.kobj);
return 0;
}
@@ -568,15 +565,6 @@
init_waitqueue_head(&queue->start_waiters);
spin_lock_init(&queue->lock);
- kobject_init(&queue->common.kobj, &simple_work_queue_kobj_type);
- result = kobject_add(&queue->common.kobj,
- parent_kobject,
- queue->common.name);
- if (result != 0) {
- uds_log_error("Cannot add sysfs node: %d", result);
- free_simple_work_queue(queue);
- return result;
- }
queue->num_priority_lists = num_priority_lists;
for (i = 0; i < WORK_QUEUE_PRIORITY_COUNT; i++) {
result = make_funnel_queue(&queue->priority_lists[i]);
@@ -682,17 +670,6 @@
return -ENOMEM;
}
- kobject_init(&queue->common.kobj, &round_robin_work_queue_kobj_type);
- result = kobject_add(&queue->common.kobj,
- parent_kobject,
- queue->common.name);
- if (result != 0) {
- uds_log_error("Cannot add sysfs node: %d", result);
- finish_work_queue(&queue->common);
- kobject_put(&queue->common.kobj);
- return result;
- }
-
*queue_ptr = &queue->common;
for (i = 0; i < thread_count; i++) {
@@ -783,7 +760,8 @@
free_funnel_queue(queue->priority_lists[i]);
}
cleanup_work_queue_stats(&queue->stats);
- kobject_put(&queue->common.kobj);
+ UDS_FREE(queue->common.name);
+ UDS_FREE(queue);
}
/**
@@ -804,7 +782,8 @@
free_simple_work_queue(queue_table[i]);
}
UDS_FREE(queue_table);
- kobject_put(&queue->common.kobj);
+ UDS_FREE(queue->common.name);
+ UDS_FREE(queue);
}
/**********************************************************************/

View File

@ -1,20 +1,17 @@
%global commit 3f9bde55d3d6bd6083af31a11eb2ac066904f581
%global gittag 8.1.0.316
%global commit f9d6d185c211659b656b0b81fed875d4e86ffd41
%global gittag 8.1.1.287
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%define spec_release 10
%define kmod_name kvdo
%define kmod_driver_version %{gittag}
%define kmod_rpm_release %{spec_release}
%define kmod_kernel_version 5.14.0-39.el9
%define kmod_kernel_version 5.14.0-44.el9
%define kmod_headers_version %(rpm -qa kernel-devel | sed 's/^kernel-devel-//')
%define kmod_kbuild_dir .
%define kmod_devel_package 0
Source0: https://github.com/dm-vdo/%{kmod_name}/archive/%{commit}/%{kmod_name}-%{shortcommit}.tar.gz
Patch0: 0001-Eliminate-use-of-bvec_kmap_irq.patch
Patch1: 0002-Removed-usage-of-removed-elevator-constants.patch
Patch2: 0003-TEMP_RIP_OUT_SYSFS.patch
%define findpat %( echo "%""P" )
@ -107,9 +104,6 @@ printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --dracut=/usr/bin/dracu
%prep
%setup -n %{kmod_name}-%{commit}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%{nil}
set -- *
mkdir source
@ -158,6 +152,20 @@ install -m 644 -D source/greylist.txt $RPM_BUILD_ROOT/usr/share/doc/kmod-%{kmod_
rm -rf $RPM_BUILD_ROOT
%changelog
* Sun Jan 23 2022 - Andy Walsh <awalsh@redhat.com> - 8.1.1.287-10
- Eliminated uses of "master" as part of the conscious language initiative.
- Resolves: rhbz#2023970
- Fixed potential use-after-free error found by Coverity.
- Resolves: rhbz#1999056
- Fixed bug which could result in empty flushes being issued to the storage
below vdo while suspended.
- Resolves: rhbz#2013057
- Added optional table line parameters for enabling or disabling
deduplication and compression.
- Resolves: rhbz#2007444
- Adapted to kernel API changes.
- Resolves: rhbz#2035003
* Thu Jan 06 2022 - Andy Walsh <awalsh@redhat.com> - 8.1.0.316-10
- Rebuilt for latest kernel.
- Related: rhbz#2000926

View File

@ -1 +1 @@
SHA512 (kvdo-3f9bde5.tar.gz) = dfddc291a395faf6ad0c06c5e8268c58d533c0ca67cc40f263e1e60093673f5b9f102bdb8143ee11d0f1060da6d6fd9d5d42a2bfe7eba2e71cf18cccdece1bb1
SHA512 (kvdo-f9d6d18.tar.gz) = ead16dccba682dffad24a8e8cab8202d3feda6f99505f47b87264797eb236fa212995fb97b1f3755910e0748f415b56afec10bb11514b903a97a9194d6b9e76b