]> www.infradead.org Git - users/dwmw2/qemu.git/commit
hw/xen: Watches on XenStore transactions
authorDavid Woodhouse <dwmw@amazon.co.uk>
Sun, 22 Jan 2023 22:59:49 +0000 (22:59 +0000)
committerDavid Woodhouse <dwmw@amazon.co.uk>
Wed, 1 Feb 2023 14:10:45 +0000 (14:10 +0000)
commit2f1f8418b75c9acb10e80ca9712f11c5889ee2c0
tree7e60e097b3282de8c20da7392f1e47a6bb5c93e9
parenta7f756630c482c01baa6055ac71a921a6dfe26b9
hw/xen: Watches on XenStore transactions

Firing watches on the nodes that still exist is relatively easy; just
walk the tree and look at the nodes with refcount of one.

Firing watches on *deleted* nodes is more fun. We add 'modified_in_tx'
and 'deleted_in_tx' flags to each node. Nodes with those flags cannot
be shared, as they will always be unique to the transaction in which
they were created.

When xs_node_walk would need to *create* a node as scaffolding and it
encounters a deleted_in_tx node, it can resurrect it simply by clearing
its deleted_in_tx flag. If that node originally had any *data*, they're
gone, and the modified_in_tx flag will have been set when it was first
deleted.

We then attempt to send appropriate watches when the transaction is
committed, properly delete the deleted_in_tx nodes, and remove the
modified_in_tx flag from the others.

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
hw/i386/kvm/xenstore_impl.c
tests/unit/test-xs-node.c