[NEW PATCH] BZ#726630 Use os.access twice for NFS stale handle (via gerrit-bot)
Federico Simoncelli
fsimonce at redhat.com
Thu Aug 4 16:06:41 UTC 2011
New patch submitted by Federico Simoncelli (fsimonce at redhat.com)
You can review this change at: http://gerrit.usersys.redhat.com/789
commit 0021edb573d8fbc6d171db38cd8c9c5877fca3f0
Author: Federico Simoncelli <fsimonce at redhat.com>
Date: Thu Aug 4 12:00:18 2011 +0000
BZ#726630 Use os.access twice for NFS stale handle
Change-Id: Id6a9e94361c19438495a46cc708c76e4d2b43a92
diff --git a/vdsm/storage/fileUtils.py b/vdsm/storage/fileUtils.py
index c76e097..af720e4 100644
--- a/vdsm/storage/fileUtils.py
+++ b/vdsm/storage/fileUtils.py
@@ -183,18 +183,17 @@ def validatePermissions(targetPath):
raise se.StorageServerAccessPermissionError(targetPath)
def pathExists(filename, writable=False):
- # This function is workarround for a NFS issue where
- # sometimes os.exists/os.access fails due to NFS stale handle.
- try:
- os.stat(filename)
- except OSError:
- return False
-
check = os.R_OK
if writable:
check |= os.W_OK
+ # This function is workaround for a NFS issue where sometimes
+ # os.exists/os.access fails due to NFS stale handle, in such
+ # case we need to test os.access a second time.
+ if os.access(filename, check):
+ return True
+
return os.access(filename, check)
def cleanupfiles(filelist):
More information about the vdsm-patches
mailing list