From: Andrey Zhadchenko <andrey.zhadchenko@virtuozzo.com>
To: alexander.ivanov@virtuozzo.com
Cc: devel@openvz.org
Subject: [Devel] [PATCH hci-8.1 v3 1/6] drivers/md/push_backup: correct initialization
Date: Tue, 3 Nov 2026 09:17:47 +0300 [thread overview]
Message-ID: <20261103061752.720813-2-andrey.zhadchenko@virtuozzo.com> (raw)
In-Reply-To: <20261103061752.720813-1-andrey.zhadchenko@virtuozzo.com>
Allocate pool and htable after lock, waitqueue and deadline
timer init so we are sure that pb_destroy() can be called
from anywhere. Otherwise we risk timer_delete_sync_try on
zeroed timer struct (currently luckily fine).
https://virtuozzo.atlassian.net/browse/VSTOR-152912
Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko@virtuozzo.com>
---
v2: no changes
v3: no changes
drivers/md/dm-push-backup.c | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/drivers/md/dm-push-backup.c b/drivers/md/dm-push-backup.c
index 885ea7b31cf67..9a6252f2b21e2 100644
--- a/drivers/md/dm-push-backup.c
+++ b/drivers/md/dm-push-backup.c
@@ -658,24 +658,22 @@ static int pb_ctr(struct dm_target *ti, unsigned int argc, char **argv)
pb = kzalloc(sizeof(*pb), GFP_KERNEL);
if (!pb)
goto err;
-
- pb->pbio_pool = mempool_create_slab_pool(PUSH_BACKUP_POOL_SIZE,
- pbio_cache);
- pb->pending_htable = kcalloc(PB_HASH_TABLE_SIZE,
- sizeof(struct hlist_head),
- GFP_KERNEL);
- if (!pb->pbio_pool || !pb->pending_htable)
- goto err;
-
spin_lock_init(&pb->lock);
init_rwsem(&pb->ctl_rwsem);
bio_list_init(&pb->deferred_bios);
INIT_LIST_HEAD(&pb->pending);
timer_setup(&pb->deadline_timer, pb_timer_func, 0);
-
init_waitqueue_head(&pb->waitq);
INIT_WORK(&pb->worker, do_pb_work);
+ pb->pbio_pool = mempool_create_slab_pool(PUSH_BACKUP_POOL_SIZE,
+ pbio_cache);
+ pb->pending_htable = kcalloc(PB_HASH_TABLE_SIZE,
+ sizeof(struct hlist_head),
+ GFP_KERNEL);
+ if (!pb->pbio_pool || !pb->pending_htable)
+ goto err;
+
ti->private = pb;
pb->ti = ti;
--
2.43.5
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
next prev parent reply other threads:[~2026-11-03 6:23 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 6:17 [Devel] [PATCH hci-8.1 v3 0/6] dm/push_backup: event fd interface and fixes Andrey Zhadchenko
2026-11-03 6:17 ` Andrey Zhadchenko [this message]
2026-11-03 6:25 ` [Devel] [PATCH hci-8.1 v3 1/6] drivers/md/push_backup: correct initialization no-reply
2026-11-03 6:17 ` [Devel] [PATCH hci-8.1 v3 2/6] drivers/md/push_backup: clear pb->alive under pb->lock Andrey Zhadchenko
2026-11-03 6:25 ` no-reply
2026-11-03 6:17 ` [Devel] [PATCH hci-8.1 v3 3/6] drivers/md/push_backup: do not re-arm deadline timer in push_backup_write() Andrey Zhadchenko
2026-11-03 6:26 ` no-reply
2026-11-03 6:49 ` Alexander Ivanov
2026-11-03 6:17 ` [Devel] [PATCH hci-8.1 v3 4/6] drivers/md/push_backup: fix mod_timer() usage Andrey Zhadchenko
2026-11-03 6:26 ` no-reply
2026-11-03 6:53 ` Alexander Ivanov
2026-11-03 6:17 ` [Devel] [PATCH hci-8.1 v3 5/6] drivers/md/push_backup: arm deadline timer under pb->lock Andrey Zhadchenko
2026-11-03 6:28 ` no-reply
2026-11-03 6:17 ` [Devel] [PATCH hci-8.1 v3 6/6] drivers/md/push_backup: add event file descriptor interface Andrey Zhadchenko
2026-11-03 6:31 ` no-reply
2026-11-03 6:41 ` Andrey Zhadchenko
2026-11-03 7:06 ` Alexander Ivanov
2026-11-03 7:34 ` [Devel] [PATCH hci-8.1 v3 0/6] dm/push_backup: event fd interface and fixes Alexander Ivanov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261103061752.720813-2-andrey.zhadchenko@virtuozzo.com \
--to=andrey.zhadchenko@virtuozzo.com \
--cc=alexander.ivanov@virtuozzo.com \
--cc=devel@openvz.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox