[Tarantool-patches] [PATCH v2] fio: fix race condition in mktree

Alexander Turenko alexander.turenko at tarantool.org
Mon Jan 13 18:44:50 MSK 2020


Added the comment to the code:

diff --git a/src/lua/fio.lua b/src/lua/fio.lua
index c9aeac951..4692e1026 100644
--- a/src/lua/fio.lua
+++ b/src/lua/fio.lua
@@ -364,6 +364,10 @@ fio.mktree = function(path, mode)
         local stat = fio.stat(current_dir)
         if stat == nil then
             local st, err = fio.mkdir(current_dir, mode)
+            -- fio.stat() and fio.mkdir() above are separate calls
+            -- and a file system may be changed between them. So
+            -- if the error here is due to an existing directory,
+            -- the function should not report an error.
             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))

Pushed to master, 2.3, 2.2 and 1.10.

> > Related to https://github.com/tarantool/doc/issues/1063
> 
> Side note: you can mention the ticket from other repo queue the
> following way:
> | Relates to tarantool/doc#1063

Don't sure I would prefer this way: a link is simpler for me. I left it
as an https link.


More information about the Tarantool-patches mailing list