I know this is copied from the core but I think it would be better to just mkdir and create the file without a stat.  Just handle the `os.IsExist` errors.