xenstore: fix add_change_node()
authorJuergen Gross <jgross@suse.com>
Thu, 27 Oct 2016 09:55:52 +0000 (11:55 +0200)
committerWei Liu <wei.liu2@citrix.com>
Mon, 31 Oct 2016 10:18:02 +0000 (10:18 +0000)
add_change_node() in xenstored is used to add a modified node to the
list of changed nodes of one transaction. It is being called with the
recurse parameter set to true when removing a node in order to get
watches for children of the node fired at transaction end, too.

If, however, the node to be deleted had been modified in the same
transaction the recurse parameter of add_change_node() is lost as
an entry already in the list of the changed nodes won't be entered
again.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Release-acked-by: Wei Liu <wei.liu2@citrix.com>
tools/xenstore/xenstored_transaction.c

index 34720fa6d4305732d305f3f9e7b801d1bc842751..84cb0bfac519292e6bdafbb108f11409b3df4fcf 100644 (file)
@@ -102,9 +102,13 @@ void add_change_node(struct transaction *trans, const char *node, bool recurse)
                return;
        }
 
-       list_for_each_entry(i, &trans->changes, list)
-               if (streq(i->node, node))
+       list_for_each_entry(i, &trans->changes, list) {
+               if (streq(i->node, node)) {
+                       if (recurse)
+                               i->recurse = recurse;
                        return;
+               }
+       }
 
        i = talloc(trans, struct changed_node);
        i->node = talloc_strdup(i, node);