CBSE-1052: Handle race condition for os.mkdir

There appears to be a race condition in os.makedir.  Suppose two
processes simultaneously try to create two different directories with a
common non-existent ancestor.  For example process 1 tries to create
"a/b" and process 2 tries to create "a/c".  They both check that "a"
does not exist, then both invoke makedirs on "a".  One of these will
throw OSError (due to the underlying EEXIST system error), and this
exception will be propagated.  Note that this happens even though the
two processes are trying to create two different directories and so one
would not expect either to report a problem with the directory already
existing.

Change-Id: I746880942d0523d513d9cf2806ace646621b3942
Reviewed-on: http://review.couchbase.org/34712
Tested-by: Bin Cui <bin.cui@gmail.com>
Reviewed-by: Steve Yen <steve.yen@gmail.com>