X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/37c053157cb11792bcb523ac7482a4cba9f5bde4..1efba8f3b728a3b8aa3c64c5aa09f441318ff2a8:/services/fuse/arvados_fuse/fusedir.py diff --git a/services/fuse/arvados_fuse/fusedir.py b/services/fuse/arvados_fuse/fusedir.py index 2ed6447d1f..8faf01cb6c 100644 --- a/services/fuse/arvados_fuse/fusedir.py +++ b/services/fuse/arvados_fuse/fusedir.py @@ -26,7 +26,7 @@ _logger = logging.getLogger('arvados.arvados_fuse') # Match any character which FUSE or Linux cannot accommodate as part # of a filename. (If present in a collection filename, they will # appear as underscores in the fuse mount.) -_disallowed_filename_characters = re.compile('[\x00/]') +_disallowed_filename_characters = re.compile(r'[\x00/]') class Directory(FreshBase): @@ -275,6 +275,7 @@ class CollectionDirectoryBase(Directory): self.apiconfig = apiconfig self.collection = collection self.collection_root = collection_root + self.collection_record_file = None def new_entry(self, name, item, mtime): name = self.sanitize_filename(name) @@ -437,7 +438,6 @@ class CollectionDirectory(CollectionDirectoryBase): super(CollectionDirectory, self).__init__(parent_inode, inodes, api.config, enable_write, None, self) self.api = api self.num_retries = num_retries - self.collection_record_file = None self._poll = True try: self._poll_time = (api._rootDesc.get('blobSignatureTtl', 60*60*2) // 2) @@ -647,32 +647,32 @@ class TmpCollectionDirectory(CollectionDirectoryBase): # save to the backend super(TmpCollectionDirectory, self).__init__( parent_inode, inodes, api_client.config, True, collection, self) - self.collection_record_file = None self.populate(self.mtime()) def on_event(self, *args, **kwargs): super(TmpCollectionDirectory, self).on_event(*args, **kwargs) - if self.collection_record_file: + if self.collection_record_file is None: + return - # See discussion in CollectionDirectoryBase.on_event - lockcount = 0 - try: - while True: - self.collection.lock.release() - lockcount += 1 - except RuntimeError: - pass + # See discussion in CollectionDirectoryBase.on_event + lockcount = 0 + try: + while True: + self.collection.lock.release() + lockcount += 1 + except RuntimeError: + pass - try: - with llfuse.lock: - with self.collection.lock: - self.collection_record_file.invalidate() - self.inodes.invalidate_inode(self.collection_record_file) - _logger.debug("%s invalidated collection record", self) - finally: - while lockcount > 0: - self.collection.lock.acquire() - lockcount -= 1 + try: + with llfuse.lock: + with self.collection.lock: + self.collection_record_file.invalidate() + self.inodes.invalidate_inode(self.collection_record_file) + _logger.debug("%s invalidated collection record", self) + finally: + while lockcount > 0: + self.collection.lock.acquire() + lockcount -= 1 def collection_record(self): with llfuse.lock_released: @@ -703,6 +703,9 @@ class TmpCollectionDirectory(CollectionDirectoryBase): def writable(self): return True + def flush(self): + pass + def want_event_subscribe(self): return False