From 12851d6b3a3883b8470ba3f8c18024dec51e2847 Mon Sep 17 00:00:00 2001
From: =?utf8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
Date: Fri, 13 Dec 2019 11:05:12 +0100
Subject: [PATCH] blockd: don't flush devices list on "hotplug" call
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit

The point of "hotplug" call is to add or remove a single entry to/from
devices list. Using vlist_update() and vlist_flush() was clearing whole
list (and leaving the last entry in case of adding a device).

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
 blockd.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/blockd.c b/blockd.c
index 7375b2b..e07530c 100644
--- a/blockd.c
+++ b/blockd.c
@@ -237,7 +237,6 @@ block_hotplug(struct ubus_context *ctx, struct ubus_object *obj,
 	if (!device)
 		return UBUS_STATUS_UNKNOWN_ERROR;
 
-	vlist_update(&devices);
 	if (data[MOUNT_REMOVE]) {
 		vlist_delete(&devices, &device->node);
 	} else {
@@ -257,7 +256,6 @@ block_hotplug(struct ubus_context *ctx, struct ubus_object *obj,
 		strcpy(__target, target);
 		vlist_add(&devices, &device->node, device->name);
 	}
-	vlist_flush(&devices);
 
 	return 0;
 }
-- 
2.25.1