forked from QubesOS/qubes-vmm-xen
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpatch-0002-xenstore-call-add_change_node-directly-when-writing-.patch
71 lines (62 loc) · 2.51 KB
/
patch-0002-xenstore-call-add_change_node-directly-when-writing-.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
From bb39decb3d9842ee99d888675c6ed5ca48639c02 Mon Sep 17 00:00:00 2001
From: Juergen Gross <[email protected]>
Date: Mon, 5 Dec 2016 08:48:43 +0100
Subject: [PATCH 02/25] 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 <[email protected]>
Acked-by: Wei Liu <[email protected]>
---
tools/xenstore/xenstored_core.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index 5d8afd6f3044..518a55805e7f 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -461,7 +461,7 @@ static struct node *read_node(struct connection *conn, const void *ctx,
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.
@@ -481,6 +481,8 @@ static bool write_node(struct connection *conn, const struct node *node)
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;
@@ -981,7 +983,6 @@ static void do_write(struct connection *conn, struct buffered_data *in)
}
}
- add_change_node(conn, node, false);
wrl_apply_debit_direct(conn);
fire_watches(conn, in, name, false);
send_ack(conn, XS_WRITE);
@@ -1013,7 +1014,6 @@ static void do_mkdir(struct connection *conn, struct buffered_data *in)
send_error(conn, errno);
return;
}
- add_change_node(conn, node, false);
wrl_apply_debit_direct(conn);
fire_watches(conn, in, name, false);
}
@@ -1217,7 +1217,6 @@ static void do_set_perms(struct connection *conn, struct buffered_data *in)
return;
}
- add_change_node(conn, node, false);
wrl_apply_debit_direct(conn);
fire_watches(conn, in, name, false);
send_ack(conn, XS_SET_PERMS);
--
2.25.4