From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-f196.google.com (mail-lj1-f196.google.com [209.85.208.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id ABCF846970E for ; Tue, 17 Dec 2019 18:52:27 +0300 (MSK) Received: by mail-lj1-f196.google.com with SMTP id u17so11523475lja.4 for ; Tue, 17 Dec 2019 07:52:27 -0800 (PST) From: HustonMmmavr Date: Tue, 17 Dec 2019 18:52:23 +0300 Message-Id: <20191217155223.13153-1-huston.mavr@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH] fio: fix race condition in mktree List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tarantool-patches@dev.tarantool.org, imun@tarantool.org This patch fixes a bug that occours when two instances calls fio.mktree for the same directory in parallel. Closes #4660 --- branch: https://github.com/tarantool/tarantool/tree/HustonMmmavr/gh-4660-fix-fio-mktree-race issue: https://github.com/tarantool/tarantool/issues/4660 src/lua/fio.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lua/fio.lua b/src/lua/fio.lua index cb224f3d0..c9aeac951 100644 --- a/src/lua/fio.lua +++ b/src/lua/fio.lua @@ -364,7 +364,7 @@ fio.mktree = function(path, mode) local stat = fio.stat(current_dir) if stat == nil then local st, err = fio.mkdir(current_dir, mode) - if err ~= nil then + if err ~= nil and not fio.path.is_dir(current_dir) then return false, string.format("Error creating directory %s: %s", current_dir, tostring(err)) end -- 2.23.0