Zhou Zheng Sheng has posted comments on this change.

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


Patch Set 1: (2 inline comments)

If you update the stat call as Dan says, I will give +1.

....................................................
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):
When I click the bug link, it says I am not authorized to see it. So I guest 
this function is to suppress exceptions when the path exists. os.makedirs() 
will raise exception if we create dir like '/tmp', but this function does not 
raise.
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 175:     """
Line 176:     DIR_BIT = 040000
Line 177:     params = (dirPath, mode) if mode is not None else (dirPath,)
Line 178:     try:
Line 179:         os.makedirs(*params)
os.makedirs() calls path.exist() before makedirs(), but I think it's OK, 
because when other process creates the dir in the time window between the two 
calls, an exception will be caught at line 151 at os.py, then it checks the 
errno and be happy if the path exists.
Line 180:     except OSError as e:
Line 181:         if e.errno != errno.EEXIST:
Line 182:             raise
Line 183:         else:


--
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 <[email protected]>
Gerrit-Reviewer: Ayal Baron <[email protected]>
Gerrit-Reviewer: Dan Kenigsberg <[email protected]>
Gerrit-Reviewer: Eduardo <[email protected]>
Gerrit-Reviewer: Shu Ming <[email protected]>
Gerrit-Reviewer: Yaniv Bronhaim <[email protected]>
Gerrit-Reviewer: Yeela Kaplan <[email protected]>
Gerrit-Reviewer: Zhou Zheng Sheng <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to