[NEW PATCH] BZ#726630 pathExists should handle NFS stale errno (via gerrit-bot)

Federico Simoncelli fsimonce at redhat.com
Thu Aug 4 12:29:25 UTC 2011


New patch submitted by Federico Simoncelli (fsimonce at redhat.com)

You can review this change at: http://gerrit.usersys.redhat.com/788

commit 0708c23dc421204a88ef47e8652efafde6a50297
Author: Federico Simoncelli <fsimonce at redhat.com>
Date:   Thu Aug 4 12:00:18 2011 +0000

    BZ#726630 pathExists should handle NFS stale errno
    
    Change-Id: I072542378d053d73d2865258024322a117923295

diff --git a/vdsm/storage/fileUtils.py b/vdsm/storage/fileUtils.py
index c76e097..4e64bb0 100644
--- a/vdsm/storage/fileUtils.py
+++ b/vdsm/storage/fileUtils.py
@@ -183,12 +183,15 @@ 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.
+    # 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 2 commands (stat and access) to refresh
+    # the handle.
     try:
         os.stat(filename)
-    except OSError:
-        return False
+    except OSError, e:
+        if e.errno != errno.ESTALE:
+            return False
 
     check = os.R_OK
 




More information about the vdsm-patches mailing list