2b57ade9c7
This will be reverted when a proper fix is available for the noted BZ. Currently without this patch, creating a new VDO volume will cause the system to panic. Related: rhbz#2035003
269 lines
9.0 KiB
Diff
269 lines
9.0 KiB
Diff
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);
|
|
}
|
|
|
|
/**********************************************************************/
|