File xs-10-call-add_change_node.patch of Package xen.11319
commit b4b475c3ace316589fb9b68f9d4ee9425a1a2349
Author: Juergen Gross <jgross@suse.com>
Date: Mon Dec 5 08:48:43 2016 +0100
xenstore: call add_change_node() directly when writing node
Instead of calling add_change_node() at places where write_node() is
called, do that inside write_node().
Note that there is one case where add_change_node() is called now when
a later failure will prohibit the changed node to be written: in case
of a write_node failing due to an error in tdb_store(). As the only
visible change of behavior is a stale event fired for the node, while
the failing tdb_store() signals a corrupted xenstore database, the
stale event will be the least problem of this case.
Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Index: xen-4.4.4-testing/tools/xenstore/xenstored_core.c
===================================================================
--- xen-4.4.4-testing.orig/tools/xenstore/xenstored_core.c
+++ xen-4.4.4-testing/tools/xenstore/xenstored_core.c
@@ -451,7 +451,7 @@ static struct node *read_node(struct con
return node;
}
-static bool write_node(struct connection *conn, const struct node *node)
+static bool write_node(struct connection *conn, struct node *node)
{
/*
* conn will be null when this is called from manual_node.
@@ -471,6 +471,8 @@ static bool write_node(struct connection
if (domain_is_unprivileged(conn) && data.dsize >= quota_max_entry_size)
goto error;
+ add_change_node(conn, node, false);
+
data.dptr = talloc_size(node, data.dsize);
((uint32_t *)data.dptr)[0] = node->num_perms;
((uint32_t *)data.dptr)[1] = node->datalen;
@@ -983,7 +985,6 @@ static void do_write(struct connection *
}
}
- add_change_node(conn, node, false);
wrl_apply_debit_direct(conn);
fire_watches(conn, in, name, false);
send_ack(conn, XS_WRITE);
@@ -1015,7 +1016,6 @@ static void do_mkdir(struct connection *
send_error(conn, errno);
return;
}
- add_change_node(conn, node, false);
wrl_apply_debit_direct(conn);
fire_watches(conn, in, name, false);
}
@@ -1219,7 +1219,6 @@ static void do_set_perms(struct connecti
return;
}
- add_change_node(conn, node, false);
wrl_apply_debit_direct(conn);
fire_watches(conn, in, name, false);
send_ack(conn, XS_SET_PERMS);