Change in vdsm[master]: Fix race in fileUtils.createdir().

danken at redhat.com danken at redhat.com
Mon Oct 22 20:14:39 UTC 2012


Dan Kenigsberg has posted comments on this change.

Change subject: Fix race in fileUtils.createdir().
......................................................................


Patch Set 1: I would prefer that you didn't submit this

(2 inline comments)

....................................................
File vdsm/storage/fileUtils.py
Line 166:     if not ignoreErrors and cleanupdir_errors:
Line 167:         raise RuntimeError("%s %s" % (dirPath, cleanupdir_errors))
Line 168: 
Line 169: 
Line 170: def createdir(dirPath, mode=None):
why do we even need this function? what is it but a complex rename of os.makedirs?

no one would notice if I do

  createdir = os.makedirs
Line 171:     """
Line 172:     Recursively create directory if doesn't exist
Line 173: 
Line 174:     If already exists check that permissions are as requested.


Line 181:         if e.errno != errno.EEXIST:
Line 182:             raise
Line 183:         else:
Line 184:             log.warning("Dir %s already exists", dirPath)
Line 185:             statinfo = os.stat(dirPath)
I'd avoid the stat() call unless mode is not None. over nfs it could make a difference.
Line 186:             if mode is not None and \
Line 187:                 statinfo[stat.ST_MODE] % DIR_BIT - mode % DIR_BIT != 0:
Line 188:                 raise OSError(errno.EPERM,
Line 189:                     "Existing %s dir permissions %s are not as requested %s" %


--
To view, visit http://gerrit.ovirt.org/8732
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Iac856c219a08fa0303e5da1d04f4f6b8e17e07a3
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewarszaw at redhat.com>
Gerrit-Reviewer: Ayal Baron <abaron at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Eduardo <ewarszaw at redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei at redhat.com>
Gerrit-Reviewer: Yeela Kaplan <ykaplan at redhat.com>


More information about the vdsm-patches mailing list