Merge branch '6605-arv-copy-http' closes #6605
[arvados.git] / services / fuse / arvados_fuse / __init__.py
index b7c0091a6104c398beb74e97af502f7fd18ecdcd..6ac51f43873d94ca853167b8ad4b4fefbe6e4139 100644 (file)
@@ -254,7 +254,7 @@ class Inodes(object):
         llfuse.invalidate_inode(inode)
 
     def invalidate_entry(self, inode, name):
-        llfuse.invalidate_entry(inode, name)
+        llfuse.invalidate_entry(inode, name.encode(self.encoding))
 
     def clear(self):
         self.inode_cache.clear()
@@ -407,8 +407,8 @@ class Operations(llfuse.Operations):
         entry = llfuse.EntryAttributes()
         entry.st_ino = inode
         entry.generation = 0
-        entry.entry_timeout = 60
-        entry.attr_timeout = 60
+        entry.entry_timeout = 60 if e.allow_dirent_cache else 0
+        entry.attr_timeout = 60 if e.allow_attr_cache else 0
 
         entry.st_mode = stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH
         if isinstance(e, Directory):
@@ -459,6 +459,7 @@ class Operations(llfuse.Operations):
         else:
             if parent_inode in self.inodes:
                 p = self.inodes[parent_inode]
+                self.inodes.touch(p)
                 if name == '..':
                     inode = p.parent_inode
                 elif isinstance(p, Directory) and name in p:
@@ -500,11 +501,14 @@ class Operations(llfuse.Operations):
         fh = next(self._filehandles_counter)
         self._filehandles[fh] = FileHandle(fh, p)
         self.inodes.touch(p)
+
+        _logger.debug("arv-mount open inode %i flags %x fh %i", inode, flags, fh)
+
         return fh
 
     @catch_exceptions
     def read(self, fh, off, size):
-        _logger.debug("arv-mount read %i %i %i", fh, off, size)
+        _logger.debug("arv-mount read fh %i off %i size %i", fh, off, size)
         self.read_ops_counter.add(1)
 
         if fh in self._filehandles:
@@ -587,8 +591,6 @@ class Operations(llfuse.Operations):
         else:
             raise llfuse.FUSEError(errno.EBADF)
 
-        _logger.debug("arv-mount handle.dirobj %s", handle.obj)
-
         e = off
         while e < len(handle.entries):
             if handle.entries[e][1].inode in self.inodes: