[Gluster-devel] mkdir race condition

Emmanuel Dreyfus manu at netbsd.org
Sun May 20 06:13:33 UTC 2012

Emmanuel Dreyfus <manu at netbsd.org> wrote:

> On a replicated volume, mkdir quickly followed by the rename of a new
> directory child fails. 
> # rm -Rf test && mkdir test && touch test/a && mv test/a test/b
> mv: rename test/a to test/b: No such file or directory
> # rm -Rf test && mkdir test && sleep 1 && touch test/a && mv test/a test/b
> (it works)

I just reinstalled server from release-3.3 and now things make more
sense. Any directory creation will report failure but will succeed:

bacasel# mkdir /gfs/manu
mkdir: /gfs/manu: No such file or directory
bacasel# cd /gfs
bacasel# ls

Server log reports it fails because:
[2012-05-20 07:59:23.775789] E
[posix-handle.c:412:posix_handle_mkdir_hashes] 0-pfs-posix: error mkdir
hash-1 /export/wd3a/.glusterfs/ec/e2 (No such file or directory)

It seems posix_handle_mkdir_hashes() attempts to mkdir two directories
at once: ec/ec2. How is it supposed to work? Should parent directory be
created somewhere else?

Emmanuel Dreyfus
manu at netbsd.org

More information about the Gluster-devel mailing list