[Devel] [PATCH hci-8.2 v2] dm/push_backup: remove the push_backup_read and push_backup_write messages

Andrey Zhadchenko andrey.zhadchenko at virtuozzo.com
Mon Nov 30 17:08:33 MSK 2026


Reviewed-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>

On 30/11/2026 8:49 am, Vasileios Almpanis wrote:
> ploop-backup gets the ranges to back up and reports the backed up
> ranges through the event fd of the target since v10.0.16, with the
> change "dm: rework push_backup from messages to monitoring fd"
> (b9291ec in ploop-backup). The ploop tests use the event fd since
> "test: back up through the push_backup event fd" (008044b2 in ploop).
> Nothing else sends the push_backup_read and push_backup_write messages.
> 
> push_backup_read is also the message that sleeps inside
> target_message() with md->io_barrier SRCU read locked, which is the
> reason the fd interface was added. Remove both messages, so that this
> path cannot be used again. An older ploop-backup still sends them, so
> the kernel spec now makes kernel-core conflict with ploop-backup older
> than 10.0.16, see "spec: Conflict with ploop-backup using
> push_backup_read/write messages" in vzkernel.vzspecs.
> 
> Before it took ctl_rwsem for push_backup_stop, pb_message() cleared
> pb->alive and woke the waiters. Commit 20815dd41f13 ("dm/push_backup:
> Allow to stop push_backup at any time") added this so that a stop
> could wake a push_backup_read that slept holding ctl_rwsem. With
> push_backup_read gone, no reader waits under ctl_rwsem any more. The
> block also left a window where a push_backup_start that came in
> between was torn down by the waiting stop. Drop it and check argc in
> the push_backup_stop branch again.
> 
> push_backup_write() stays, because pb_fd_write() uses it. It is now
> its only caller and never passes a NULL pb, so drop that check. Also
> drop the reference to the removed message from the comment of the fd
> write() in the uapi header, and bump the target version to 1.3.0.
> 
> https://virtuozzo.atlassian.net/browse/VSTOR-155816
> 
> Feature: dm-backup: push backup target driver
> Signed-off-by: Vasileios Almpanis <vasileios.almpanis at virtuozzo.com>
> ---
> This is v2 of the third patch of the push_backup series. Patches 1 and
> 2 went on as their own v2, and this one comes separately now that the
> ploop test and the packaging are ready.
> 
> ploop-backup uses the event fd since v10.0.16 and the ploop tests since
> ploop commit 008044b2. The kernel spec change "spec: Conflict with
> ploop-backup using push_backup_read/write messages" in vzkernel.vzspecs
> keeps an older ploop-backup off a node with this kernel.
> 
> I tested the patch on 8.2 with a debug kernel with KASAN, lockdep and
> kmemleak enabled, on top of the v2 of patches 1 and 2. The tests
> covered the removed messages, push_backup_stop with and without a
> session, a stop that wakes a reader blocked on the event fd, concurrent
> start and stop, a backup through the event fd and the ploop
> push_backup tests. KASAN, lockdep and kmemleak reported nothing.
> 
> https://virtuozzo.atlassian.net/browse/VSTOR-155816
> ---
> Changes in v2:
> - Move the ploop test to the event fd first and name ploop-backup
>    v10.0.16 and the ploop change instead of the kernel commit.
> - Make kernel-core conflict with older ploop-backup in the kernel spec.
> - Drop the push_backup_stop step before ctl_rwsem in pb_message() and
>    check argc in the push_backup_stop branch again.
> - Drop the dead NULL check in push_backup_write() and bump the target
>    version to 1.3.0.
> - Link to v1: http://lore.virtuozzo.com/20261125-push-backup-fixes-v1-3-8d5cc55c30a1@virtuozzo.com
> ---
>   drivers/md/dm-push-backup.c         | 43 ++-----------------------------------
>   include/uapi/linux/dm-push-backup.h |  5 ++---
>   2 files changed, 4 insertions(+), 44 deletions(-)
> 
> diff --git a/drivers/md/dm-push-backup.c b/drivers/md/dm-push-backup.c
> index 745ed28fd074..0b313b2bd319 100644
> --- a/drivers/md/dm-push-backup.c
> +++ b/drivers/md/dm-push-backup.c
> @@ -548,24 +548,6 @@ static int pb_wait_range(struct push_backup *pb, u64 *clu, u64 *nr)
>   	}
>   }
>   
> -static int push_backup_read(struct push_backup *pb,
> -			    char *result, unsigned int maxlen)
> -{
> -	unsigned int sz = 0;
> -	u64 clu, nr;
> -	int ret;
> -
> -	if (!pb)
> -		return -EBADF;
> -
> -	ret = pb_wait_range(pb, &clu, &nr);
> -	if (ret == -ERESTARTSYS)
> -		ret = -EINTR;
> -	if (ret == 1)
> -		DMEMIT("%llu:%llu", clu, nr);
> -	return ret;
> -}
> -
>   static int push_backup_write(struct push_backup *pb, u64 clu, u64 nr)
>   {
>   	u64 i, key, nr_clus = pb->nr_clus;
> @@ -573,8 +555,6 @@ static int push_backup_write(struct push_backup *pb, u64 clu, u64 nr)
>   	bool finished;
>   	struct pb_bio *pbio;
>   
> -	if (!pb)
> -		return -EBADF;
>   	if (clu >= nr_clus || nr > nr_clus - clu)
>   		return -E2BIG;
>   
> @@ -751,19 +731,6 @@ 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;
> -
> -		spin_lock_irq(&pb->lock);
> -		pb->alive = false;
> -		spin_unlock_irq(&pb->lock);
> -		wake_up_interruptible(&pb->waitq); /* pb->alive = false */
> -	}
> -
>   	write = msg_wants_down_write(argv[0]);
>   	if (write)
>   		ret = down_write_killable(&pb->ctl_rwsem);
> @@ -787,15 +754,9 @@ static int pb_message(struct dm_target *ti, unsigned int argc, char **argv,
>   		if (!ret && argc == 4)
>   			pb_watch_pid(pb);
>   	} else if (!strcmp(argv[0], "push_backup_stop")) {
> -		ret = push_backup_stop(pb, result, maxlen);
> -	} else if (!strcmp(argv[0], "push_backup_read")) {
>   		if (argc != 1)
>   			goto unlock;
> -		ret = push_backup_read(pb, result, maxlen);
> -	} else if (!strcmp(argv[0], "push_backup_write")) {
> -		if (argc != 2 || sscanf(argv[1], "%llu:%llu", &val, &val2) != 2)
> -			goto unlock;
> -		ret = push_backup_write(pb, val, val2);
> +		ret = push_backup_stop(pb, result, maxlen);
>   	} else if (!strcmp(argv[0], "push_backup_statistics")) {
>   		ret = push_backup_statistics(pb, result, maxlen);
>   	} else if (!strcmp(argv[0], "push_backup_get_fd")) {
> @@ -975,7 +936,7 @@ static loff_t pb_llseek_hole(struct dm_target *ti, loff_t offset,
>   
>   static struct target_type pb_target = {
>   	.name = "push_backup",
> -	.version = {1, 2, 0},
> +	.version = {1, 3, 0},
>   	.features = DM_TARGET_SINGLETON,
>   	.module = THIS_MODULE,
>   	.ctr = pb_ctr,
> diff --git a/include/uapi/linux/dm-push-backup.h b/include/uapi/linux/dm-push-backup.h
> index b43e2e55dc69..b8d336f9fcc2 100644
> --- a/include/uapi/linux/dm-push-backup.h
> +++ b/include/uapi/linux/dm-push-backup.h
> @@ -30,9 +30,8 @@
>    *   EBADMSG       - internal inconsistency of the pending state.
>    *
>    * write(fd, &range, sizeof(range)):
> - *   acknowledge that @range has been backed up; equivalent to the
> - *   "push_backup_write clu:nr" message. Fails with E2BIG if @range is out
> - *   of the device, ESTALE and ENODEV as read(), and EFAULT.
> + *   acknowledge that @range has been backed up. Fails with E2BIG if @range
> + *   is out of the device, ESTALE and ENODEV as read(), and EFAULT.
>    */
>   #ifndef _UAPI_LINUX_DM_PUSH_BACKUP_H
>   #define _UAPI_LINUX_DM_PUSH_BACKUP_H
> 
> ---
> base-commit: aef96420256e57bf1291859a844800a462f2790e
> change-id: 20261126-push-backup-messages-dfb26a564ecc
> 



More information about the Devel mailing list