All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: "Edwin Török" <edvin.torok@citrix.com>,
	"Christian Lindig" <christian.lindig@citrix.com>,
	"Ian Jackson" <iwj@xenproject.org>, "Wei Liu" <wl@xen.org>
Subject: [PATCH 3/3] tools/oxenstored: mkdir conflicts were sometimes missed
Date: Wed, 3 Feb 2021 17:35:49 +0000	[thread overview]
Message-ID: <20210203173549.21159-4-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <20210203173549.21159-1-andrew.cooper3@citrix.com>

From: Edwin Török <edvin.torok@citrix.com>

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>
---
CC: Christian Lindig <christian.lindig@citrix.com>
CC: Ian Jackson <iwj@xenproject.org>
CC: Wei Liu <wl@xen.org>
---
 tools/ocaml/xenstored/transaction.ml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/ocaml/xenstored/transaction.ml b/tools/ocaml/xenstored/transaction.ml
index 25bc8c3b4a..17b1bdf2ea 100644
--- a/tools/ocaml/xenstored/transaction.ml
+++ b/tools/ocaml/xenstored/transaction.ml
@@ -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
 
-- 
2.11.0



  parent reply	other threads:[~2021-02-03 17:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-03 17:35 [PATCH for-4.15 0/3] tools/oxenstored bugfixes Andrew Cooper
2021-02-03 17:35 ` [PATCH 1/3] tools/oxenstored: Fix quota calculation for mkdir EEXIST Andrew Cooper
2021-02-03 17:40   ` Ian Jackson
2021-02-03 17:35 ` [PATCH 2/3] tools/oxenstored: Reject invalid watch paths early Andrew Cooper
2021-02-04 10:51   ` Christian Lindig
2021-02-03 17:35 ` Andrew Cooper [this message]
2021-02-04 10:52   ` [PATCH 3/3] tools/oxenstored: mkdir conflicts were sometimes missed Christian Lindig
2021-02-03 17:41 ` [PATCH for-4.15 0/3] tools/oxenstored bugfixes Ian Jackson
2021-02-04 10:46 ` Christian Lindig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210203173549.21159-4-andrew.cooper3@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=christian.lindig@citrix.com \
    --cc=edvin.torok@citrix.com \
    --cc=iwj@xenproject.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.