Skip to content
This repository was archived by the owner on Jun 11, 2026. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions azfilesfuse.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def write(self):
# update the range specified by this write.
#logger.debug('updating %s range %d to %d', path, self.offset, self.offset+data_length-1)
self.files._files_service.update_range(self.files._azure_file_share_name, self.directory, self.filename, self.data, start_range=self.offset, end_range=self.offset+data_length-1)
self.files.file_cache[self.orig_path].writes.remove(self)

except AzureHttpError as ahe:
self.files._prior_write_failure = True
Expand All @@ -112,7 +113,8 @@ def __init__(self):
self.write_lock = threading.Lock()
self.append_write_lock = threading.Lock()
self.max_size = 0
self.writes = deque()
self.last_write = None
self.writes = set()
self.pending_writes = set()


Expand All @@ -137,10 +139,10 @@ def __init__(self, azure_storage_account_name, azure_file_share_name, sas_token)

self._prior_write_failure = False

self.writes = deque()

self.dir_cache = {}

self.id = 0

self.file_cache = defaultdict(FileCache)

def _get_separated_path(self, path):
Expand Down Expand Up @@ -502,8 +504,8 @@ def write(self, path, data, offset, fh):
# Take the write lock to see if we can coalesce
with self.file_cache[orig_path].append_write_lock:
found = False
if self.file_cache[orig_path].writes and not self._prior_write_failure:
last = self.file_cache[orig_path].writes[-1]
if self.file_cache[orig_path].last_write and not self._prior_write_failure:
last = self.file_cache[orig_path].last_write
if (not last.processing and
(last.offset + len(last.data)) == offset and
len(last.data) + len(data) < file.FileService.MAX_RANGE_SIZE):
Expand All @@ -513,7 +515,8 @@ def write(self, path, data, offset, fh):

if not found:
wi = WriteInfo(self, directory, filename, offset, data, orig_path)
self.file_cache[orig_path].writes.append(wi)
self.file_cache[orig_path].last_write = wi
self.file_cache[orig_path].writes.add(wi)

# If we failed at some point (potentially in an async write) do this one immediately
# to see if the remote FS is functional and not hide the failure from the OS.
Expand Down