tools/xenstore: rework node removal
authorJuergen Gross <jgross@suse.com>
Tue, 15 Dec 2020 12:34:48 +0000 (13:34 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 15 Dec 2020 12:34:48 +0000 (13:34 +0100)
commit297f209636d89ca5bfe2b91accfdf0dc1b922779
tree18ec84d9379f1bb7d4b1384cf5c542c5c9b7d187
parentfa2307be61df52970e7ee47a6c55124155c173c6
tools/xenstore: rework node removal

Today a Xenstore node is being removed by deleting it from the parent
first and then deleting itself and all its children. This results in
stale entries remaining in the data base in case e.g. a memory
allocation is failing during processing. This would result in the
rather strange behavior to be able to read a node (as its still in the
data base) while not being visible in the tree view of Xenstore.

Fix that by deleting the nodes from the leaf side instead of starting
at the root.

As fire_watches() is now called from _rm() the ctx parameter needs a
const attribute.

This is part of XSA-115.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Paul Durrant <paul@xen.org>
tools/xenstore/xenstored_core.c
tools/xenstore/xenstored_watch.c
tools/xenstore/xenstored_watch.h