[Devel] [PATCH RH8] push-backup: Make addr argument of start optional

Kirill Tkhai ktkhai at virtuozzo.com
Tue Jul 6 19:00:22 MSK 2021


Full backup may skip passing address argument.

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/md/dm-push-backup.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/md/dm-push-backup.c b/drivers/md/dm-push-backup.c
index f1637e70b599..62bf314fbe04 100644
--- a/drivers/md/dm-push-backup.c
+++ b/drivers/md/dm-push-backup.c
@@ -532,8 +532,12 @@ static int pb_message(struct dm_target *ti, unsigned int argc, char **argv,
 		down_write(&pb->ctl_rwsem);
 
 	if (!strcmp(argv[0], "push_backup_start")) {
-		if (argc != 3 || kstrtou64(argv[1], 10, &val) < 0 ||
-				 kstrtou64(argv[2], 10, &val2) < 0)
+		if (argc < 2 || argc > 3)
+			goto unlock;
+		if (kstrtou64(argv[1], 10, &val) < 0)
+			goto unlock;
+		val2 = 0;
+		if (argc == 3 && kstrtou64(argv[2], 10, &val2) < 0)
 			goto unlock;
 		ret = push_backup_start(pb, val, (void *)val2);
 	} else if (!strcmp(argv[0], "push_backup_stop")) {




More information about the Devel mailing list