]> xenbits.xensource.com Git - xen.git/commit
oxenstored: Quota.merge: don't assume domain already exists
authorJonathan Davies <jonathan.davies@citrix.com>
Wed, 11 Nov 2015 11:21:53 +0000 (11:21 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Mon, 16 Nov 2015 11:15:58 +0000 (11:15 +0000)
commit82ff7cbed64e3cc094d6812b3ad672c660649969
tree225c1877afbd5b8460d5ad1d24f4c7b7b4f7f903
parent618659b38cab90e300085591b2bf398dbfc66b03
oxenstored: Quota.merge: don't assume domain already exists

In Quota.merge, we merge two quota hashtables, orig_quota and mod_quota, putting
the results into dest_quota. These hashtables map domids to the number of
entries currently owned by that domain.

When mod_quota contains an entry for a domid that was not present in orig_quota
(or dest_quota), the call to get_entry caused Quota.merge to raise a Not_found
exception. This propagates back to the client as an ENOENT error, which is not
an appropriate return value from some operations, such as transaction_end.

This situation can arise when a transaction that introduces a domain (hence
calling Quota.add_entry) needs to be coalesced due to concurrent xenstore
activity.

This patch handles the merge in the case where mod_quota contains an entry not
present in orig_quota (or in dest_quota) by treating that hashtable as having
existing value 0.

Signed-off-by: Jonathan Davies <jonathan.davies@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/ocaml/xenstored/quota.ml