aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xenstore/xenstored_transaction.c
diff options
context:
space:
mode:
authorcl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>2005-07-26 15:20:09 +0000
committercl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>2005-07-26 15:20:09 +0000
commitef071736546681facfdc36617632bdafd6c4d4a4 (patch)
tree49b258982283aa0aa0b9017834b6dbffa92b4927 /tools/xenstore/xenstored_transaction.c
parente04c630cb24b65d871f061074bea23174cadf841 (diff)
downloadxen-ef071736546681facfdc36617632bdafd6c4d4a4.tar.gz
xen-ef071736546681facfdc36617632bdafd6c4d4a4.tar.bz2
xen-ef071736546681facfdc36617632bdafd6c4d4a4.zip
Change watches: operations block until everyone has acked.
Watch events are no longer sent to self Watches no longer take a priority async and asyncwait commands for xs_test, now we need to continue despite blocking ops. Print test name at end of verbose run on failure. Use --trace-file arg to xenstored when testing Signed-off-by: Rusty Russel <rusty@rustcorp.com.au> Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
Diffstat (limited to 'tools/xenstore/xenstored_transaction.c')
-rw-r--r--tools/xenstore/xenstored_transaction.c39
1 files changed, 22 insertions, 17 deletions
diff --git a/tools/xenstore/xenstored_transaction.c b/tools/xenstore/xenstored_transaction.c
index 60dcf04130..afaef1bef2 100644
--- a/tools/xenstore/xenstored_transaction.c
+++ b/tools/xenstore/xenstored_transaction.c
@@ -288,7 +288,6 @@ void do_transaction_start(struct connection *conn, const char *node)
static bool commit_transaction(struct transaction *trans)
{
char *tmp, *dir;
- struct changed_node *i;
/* Move: orig -> .old, repl -> orig. Cleanup deletes .old. */
dir = node_dir_outside_transaction(trans->node);
@@ -301,15 +300,15 @@ static bool commit_transaction(struct transaction *trans)
trans->divert, dir);
trans->divert = tmp;
-
- /* Fire off the watches for everything that changed. */
- list_for_each_entry(i, &trans->changes, list)
- fire_watches(NULL, i->node, i->recurse);
return true;
}
void do_transaction_end(struct connection *conn, const char *arg)
{
+ struct changed_node *i;
+ struct transaction *trans;
+ bool fired = false;
+
if (!arg || (!streq(arg, "T") && !streq(arg, "F"))) {
send_error(conn, EINVAL);
return;
@@ -320,24 +319,30 @@ void do_transaction_end(struct connection *conn, const char *arg)
return;
}
+ /* Set to NULL so fire_watches sends events. */
+ trans = conn->transaction;
+ conn->transaction = NULL;
+ /* Attach transaction to arg for auto-cleanup */
+ talloc_steal(arg, trans);
+
if (streq(arg, "T")) {
- if (conn->transaction->destined_to_fail) {
+ if (trans->destined_to_fail) {
send_error(conn, ETIMEDOUT);
- goto failed;
+ return;
}
- if (!commit_transaction(conn->transaction)) {
+ if (!commit_transaction(trans)) {
send_error(conn, errno);
- goto failed;
+ return;
}
- }
- talloc_free(conn->transaction);
- conn->transaction = NULL;
- send_ack(conn, XS_TRANSACTION_END);
- return;
+ /* Fire off the watches for everything that changed. */
+ list_for_each_entry(i, &trans->changes, list)
+ fired |= fire_watches(conn, i->node, i->recurse);
+ }
-failed:
- talloc_free(conn->transaction);
- conn->transaction = NULL;
+ if (fired)
+ conn->watch_ack = XS_TRANSACTION_END;
+ else
+ send_ack(conn, XS_TRANSACTION_END);
}