Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0AE3DC433DB for ; Wed, 3 Feb 2021 17:36:24 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9E63E64F84 for ; Wed, 3 Feb 2021 17:36:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9E63E64F84 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.80998.148801 (Exim 4.92) (envelope-from ) id 1l7M4Z-0008Uw-6K; Wed, 03 Feb 2021 17:36:11 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 80998.148801; Wed, 03 Feb 2021 17:36:11 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1l7M4Y-0008Ul-Vr; Wed, 03 Feb 2021 17:36:10 +0000 Received: by outflank-mailman (input) for mailman id 80998; Wed, 03 Feb 2021 17:36:10 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1l7M4Y-0008Tz-5S for xen-devel@lists.xenproject.org; Wed, 03 Feb 2021 17:36:10 +0000 Received: from esa2.hc3370-68.iphmx.com (unknown [216.71.145.153]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 8b008ad3-6a96-418a-91a1-c75a1770c9a8; Wed, 03 Feb 2021 17:36:08 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 8b008ad3-6a96-418a-91a1-c75a1770c9a8 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1612373768; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=g+a0zjEE5v0WInnTQX+eiSAhYh9ndjnBsYijZ422tKA=; b=fs8xPXZKpH1sZfIJlXXr+ldYqu/g/tiqtxvJDMOXUddIMOtmmgbBk6hy WM5ZlfpvNSeUQDxVxMmT9INJl83SCUz6kCsAJtjzmKnG5HjO35MN54khp nE++qJZROaJZ8+jn0EUrIEZ2Y75sB3Ofo9GF0p11FC+rKug1WnZm2uuZq k=; Authentication-Results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: +x0IaZ3Lv3ThQBPVJscpHNRMxzB/BYwmXJhwj5OFmM6hJOqn45xZqQCsWXfPxdtUitE8b+bm0r YOKqsNPk7vmN1z3mTSA+c/oNaMdzlREZdwzF1aKNdeHVqh1HXe/rs3UxGM1NCbI/L2lHHI6Pdx EblhuLgnJO5COnFhalVab6pGjV+lo00qV+TVJXOLSgE6D2FgfVFah6car82xxYk4GAlclweyQT Idq1iFqQaucakg53vqqKN+aBawbcP1E6tJcyhzb8VpK4TJuQWqW+Ln7Hzus+Xw3te1q04myv6T ues= X-SBRS: 4.0 X-MesageID: 36517500 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.79,399,1602561600"; d="scan'208";a="36517500" From: Andrew Cooper To: Xen-devel CC: =?UTF-8?q?Edwin=20T=C3=B6r=C3=B6k?= , "Christian Lindig" , Ian Jackson , "Wei Liu" Subject: [PATCH 3/3] tools/oxenstored: mkdir conflicts were sometimes missed Date: Wed, 3 Feb 2021 17:35:49 +0000 Message-ID: <20210203173549.21159-4-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20210203173549.21159-1-andrew.cooper3@citrix.com> References: <20210203173549.21159-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit From: Edwin Török 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 --- CC: Christian Lindig CC: Ian Jackson CC: Wei Liu --- 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