]> www.infradead.org Git - users/dwmw2/qemu.git/commit
hw/xen: Implement XenStore transactions
authorDavid Woodhouse <dwmw@amazon.co.uk>
Sun, 22 Jan 2023 22:05:37 +0000 (22:05 +0000)
committerDavid Woodhouse <dwmw@amazon.co.uk>
Thu, 2 Mar 2023 13:50:07 +0000 (13:50 +0000)
commit6a2c17757f2cb0d361405e6cb6a84fa69bdd0a0c
tree721ac5597000292e6b08bc61d431afbd26d0b522
parent18b498252f5c5976f8a837a97ae3c546dfa6ae76
hw/xen: Implement XenStore transactions

Given that the whole thing supported copy on write from the beginning,
transactions end up being fairly simple. On starting a transaction, just
take a ref of the existing root; swap it back in on a successful commit.

The main tree has a transaction ID too, and we keep a record of the last
transaction ID given out. if the main tree is ever modified when it isn't
the latest, it gets a new transaction ID.

A commit can only succeed if the main tree hasn't moved on since it was
forked. Strictly speaking, the XenStore protocol allows a transaction to
succeed as long as nothing *it* read or wrote has changed in the interim,
but no implementations do that; *any* change is sufficient to abort a
transaction.

This does not yet fire watches on the changed nodes on a commit. That bit
is more fun and will come in a follow-on commit.

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