The commit is pushed to "branch-rh9-5.14.0-162.6.1.vz9.18.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git after rh9-5.14.0-162.6.1.vz9.18.11 ------> commit 845cd8f772fc7e1ce34b7a910eff6a99d005cd24 Author: Andrey Zhadchenko <andrey.zhadche...@virtuozzo.com> Date: Mon Feb 13 19:36:43 2023 +0300
dm/push_backup: Allow to stop push_backup at any time Currently push_backup device cannot be stopped if any process in a system is waiting next push block via push_backup_read. This means we have to kill that process or thread to release push_backup device, as it holds pb->ctl_rwsem. Change code so push_backup is marked !alive and all waiters are woken up before acquiring the lock. This is safe to do as pb->alive is only used for determining if we should postpone new I/O and process user push_backup_read/push_backup_write. All operations like releasing I/O or memory will be done with acquired lock as soon as all kicked readers exit syscall. https://jira.sw.ru/browse/PSBM-145865 Signed-off-by: Andrey Zhadchenko <andrey.zhadche...@virtuozzo.com> Feature: dm-backup: push backup target driver --- drivers/md/dm-push-backup.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/md/dm-push-backup.c b/drivers/md/dm-push-backup.c index b0e9e78f021a..370bd23a70ff 100644 --- a/drivers/md/dm-push-backup.c +++ b/drivers/md/dm-push-backup.c @@ -574,6 +574,17 @@ static int pb_message(struct dm_target *ti, unsigned int argc, char **argv, if (argc < 1) goto out; + if (!strcmp(argv[0], "push_backup_stop")) { + if (argc != 1) + goto out; + + if (!pb->map) + return -EBADF; + + pb->alive = false; + wake_up_interruptible(&pb->waitq); /* pb->alive = false */ + } + write = msg_wants_down_write(argv[0]); if (write) ret = down_write_killable(&pb->ctl_rwsem); @@ -592,8 +603,6 @@ static int pb_message(struct dm_target *ti, unsigned int argc, char **argv, goto unlock; ret = push_backup_start(pb, val, (void *)val2); } else if (!strcmp(argv[0], "push_backup_stop")) { - if (argc != 1) - goto unlock; ret = push_backup_stop(pb, result, maxlen); } else if (!strcmp(argv[0], "push_backup_read")) { if (argc != 1) _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel