]> xenbits.xensource.com Git - xen.git/commitdiff
tools/oxenstored: mkdir conflicts were sometimes missed
authorEdwin Török <edvin.torok@citrix.com>
Fri, 15 Jan 2021 19:38:58 +0000 (19:38 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 4 Feb 2021 14:17:44 +0000 (14:17 +0000)
Due to how set_write_lowpath was used here it didn't detect create/delete
conflicts.  When we create an entry we must mark our parent as modified
(this is what creating a new node via write does).

Otherwise we can have 2 transactions one creating, and another deleting a node
both succeeding depending on timing.  Or one transaction reading an entry,
concluding it doesn't exist, do some other work based on that information and
successfully commit even if another transaction creates the node via mkdir
meanwhile.

Signed-off-by: Edwin Török <edvin.torok@citrix.com>
Acked-by: Christian Lindig <christian.lindig@citrix.com>
Release-Acked-by: Ian Jackson <iwj@xenproject.org>
tools/ocaml/xenstored/transaction.ml

index 25bc8c3b4aeacca6bcb4a18ae06be110baef146f..17b1bdf2eaf9fdcbd3d1cea1266e7e556d3311a1 100644 (file)
@@ -165,7 +165,7 @@ let write t perm path value =
 
 let mkdir ?(with_watch=true) t perm path =
        Store.mkdir t.store perm path;
-       set_write_lowpath t path;
+       set_write_lowpath t (Store.Path.get_parent path);
        if with_watch then
                add_wop t Xenbus.Xb.Op.Mkdir path