* [Drbd-dev] [PATCH v4 0/2] drbd bugfix and cleanup.
@ 2022-11-24 1:58 Wang ShaoBo
2022-11-24 1:58 ` [Drbd-dev] [PATCH v4 1/2] drbd: remove call to memset before free device/resource/connection Wang ShaoBo
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Wang ShaoBo @ 2022-11-24 1:58 UTC (permalink / raw)
Cc: axboe, bobo.shaobowang, linux-block, lars.ellenberg, liwei391,
drbd-dev
drbd bugfix and cleanup.
v4:
- solve conflict in applying patch [2/2] to for-6.2/block branch
v3:
- add out_* label for destroy_workqueue().
v2:
- add new patch for removing useless memset().
Wang ShaoBo (2):
drbd: remove call to memset before free device/resource/connection
drbd: destroy workqueue when drbd device was freed
drivers/block/drbd/drbd_main.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Drbd-dev] [PATCH v4 1/2] drbd: remove call to memset before free device/resource/connection
2022-11-24 1:58 [Drbd-dev] [PATCH v4 0/2] drbd bugfix and cleanup Wang ShaoBo
@ 2022-11-24 1:58 ` Wang ShaoBo
2022-11-24 1:58 ` [Drbd-dev] [PATCH v4 2/2] drbd: destroy workqueue when drbd device was freed Wang ShaoBo
2022-11-24 13:42 ` [Drbd-dev] [PATCH v4 0/2] drbd bugfix and cleanup Jens Axboe
2 siblings, 0 replies; 4+ messages in thread
From: Wang ShaoBo @ 2022-11-24 1:58 UTC (permalink / raw)
Cc: axboe, bobo.shaobowang, linux-block, lars.ellenberg, liwei391,
drbd-dev
This revert c2258ffc56f2 ("drbd: poison free'd device, resource and
connection structs"), add memset is odd here for debugging, there are
some methods to accurately show what happened, such as kdump.
Signed-off-by: Wang ShaoBo <bobo.shaobowang@huawei.com>
---
drivers/block/drbd/drbd_main.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index ec913820d0b8..b4ae508abf49 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -2217,7 +2217,6 @@ void drbd_destroy_device(struct kref *kref)
kref_put(&peer_device->connection->kref, drbd_destroy_connection);
kfree(peer_device);
}
- memset(device, 0xfd, sizeof(*device));
kfree(device);
kref_put(&resource->kref, drbd_destroy_resource);
}
@@ -2309,7 +2308,6 @@ void drbd_destroy_resource(struct kref *kref)
idr_destroy(&resource->devices);
free_cpumask_var(resource->cpu_mask);
kfree(resource->name);
- memset(resource, 0xf2, sizeof(*resource));
kfree(resource);
}
@@ -2650,7 +2648,6 @@ void drbd_destroy_connection(struct kref *kref)
drbd_free_socket(&connection->data);
kfree(connection->int_dig_in);
kfree(connection->int_dig_vv);
- memset(connection, 0xfc, sizeof(*connection));
kfree(connection);
kref_put(&resource->kref, drbd_destroy_resource);
}
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Drbd-dev] [PATCH v4 2/2] drbd: destroy workqueue when drbd device was freed
2022-11-24 1:58 [Drbd-dev] [PATCH v4 0/2] drbd bugfix and cleanup Wang ShaoBo
2022-11-24 1:58 ` [Drbd-dev] [PATCH v4 1/2] drbd: remove call to memset before free device/resource/connection Wang ShaoBo
@ 2022-11-24 1:58 ` Wang ShaoBo
2022-11-24 13:42 ` [Drbd-dev] [PATCH v4 0/2] drbd bugfix and cleanup Jens Axboe
2 siblings, 0 replies; 4+ messages in thread
From: Wang ShaoBo @ 2022-11-24 1:58 UTC (permalink / raw)
Cc: axboe, bobo.shaobowang, linux-block, lars.ellenberg, liwei391,
drbd-dev
A submitter workqueue is dynamically allocated by init_submitter()
called by drbd_create_device(), we should destroy it when this
device is not needed or destroyed.
Fixes: 113fef9e20e0 ("drbd: prepare to queue write requests on a submit worker")
Signed-off-by: Wang ShaoBo <bobo.shaobowang@huawei.com>
---
v4:
- solve conflict in applying patch [2/2] to for-6.2/block branch
v3:
- add out_* label for destroy_workqueue().
drivers/block/drbd/drbd_main.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index b4ae508abf49..e02db1dccab1 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -2217,6 +2217,8 @@ void drbd_destroy_device(struct kref *kref)
kref_put(&peer_device->connection->kref, drbd_destroy_connection);
kfree(peer_device);
}
+ if (device->submit.wq)
+ destroy_workqueue(device->submit.wq);
kfree(device);
kref_put(&resource->kref, drbd_destroy_resource);
}
@@ -2771,7 +2773,7 @@ enum drbd_ret_code drbd_create_device(struct drbd_config_context *adm_ctx, unsig
err = add_disk(disk);
if (err)
- goto out_idr_remove_from_resource;
+ goto out_destroy_workqueue;
/* inherit the connection state */
device->state.conn = first_connection(resource)->cstate;
@@ -2785,6 +2787,8 @@ enum drbd_ret_code drbd_create_device(struct drbd_config_context *adm_ctx, unsig
drbd_debugfs_device_add(device);
return NO_ERROR;
+out_destroy_workqueue:
+ destroy_workqueue(device->submit.wq);
out_idr_remove_from_resource:
for_each_connection(connection, resource) {
peer_device = idr_remove(&connection->peer_devices, vnr);
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Drbd-dev] [PATCH v4 0/2] drbd bugfix and cleanup.
2022-11-24 1:58 [Drbd-dev] [PATCH v4 0/2] drbd bugfix and cleanup Wang ShaoBo
2022-11-24 1:58 ` [Drbd-dev] [PATCH v4 1/2] drbd: remove call to memset before free device/resource/connection Wang ShaoBo
2022-11-24 1:58 ` [Drbd-dev] [PATCH v4 2/2] drbd: destroy workqueue when drbd device was freed Wang ShaoBo
@ 2022-11-24 13:42 ` Jens Axboe
2 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2022-11-24 13:42 UTC (permalink / raw)
To: Wang ShaoBo; +Cc: linux-block, lars.ellenberg, liwei391, drbd-dev
On Thu, 24 Nov 2022 09:58:15 +0800, Wang ShaoBo wrote:
> drbd bugfix and cleanup.
>
> v4:
> - solve conflict in applying patch [2/2] to for-6.2/block branch
>
> v3:
> - add out_* label for destroy_workqueue().
>
> [...]
Applied, thanks!
[1/2] drbd: remove call to memset before free device/resource/connection
commit: 6e7b854e4c1b02dba00760dfa79d8dbf6cce561e
[2/2] drbd: destroy workqueue when drbd device was freed
commit: 8692814b77ca4228a99da8a005de0acf40af6132
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-11-24 13:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-24 1:58 [Drbd-dev] [PATCH v4 0/2] drbd bugfix and cleanup Wang ShaoBo
2022-11-24 1:58 ` [Drbd-dev] [PATCH v4 1/2] drbd: remove call to memset before free device/resource/connection Wang ShaoBo
2022-11-24 1:58 ` [Drbd-dev] [PATCH v4 2/2] drbd: destroy workqueue when drbd device was freed Wang ShaoBo
2022-11-24 13:42 ` [Drbd-dev] [PATCH v4 0/2] drbd bugfix and cleanup Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox