* mount: wake an upload parked on a read when the read ends
An upload that finishes while a read holds its chunk waits in its own
goroutine until the read lets go (`for up.IsLocked(index) {
up.readerCountCond.Wait() }`), and only then drops the sealed chunk and
returns its executor slot. The only wake-up came from MaybeReadDataAt,
which a read calls before it lets go of the chunk. UnlockForRead, where
the read does let go, woke nobody. So:
- A read that returns before its dirty-page pass never wakes the
upload. readDataByFileHandleWithContext skips readFromDirtyPages when
the chunk read fails, and the kernel interrupts a FUSE read, which
cancels it, whenever a signal reaches the reading thread.
- A read that does call MaybeReadDataAt wakes the upload while it still
holds the chunk, so the upload goes back to waiting unless the read
releases the chunk before the upload gets the lock back.
Only a later read of the same file then moves the upload on. When none
comes, because the file was closed or is no longer read, the upload
stays parked for good. It keeps its sealed chunk (and its share of
-writeBufferSizeMB, when that is set) and a slot of the
concurrentWriters executor, which every file of the mount shares (128
by default). Once parked uploads hold every slot, each new upload of
the mount waits for one, and writes and flushes behind them hang.
UnlockForRead now broadcasts when the last read of a chunk ends, which
is the only place the condition changes, and MaybeReadDataAt no longer
signals. It broadcasts rather than signals: a read across a chunk
boundary releases two chunks, and an upload may be parked on each.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* mount: wait for the uploads to park instead of sleeping in the wake-up tests
parkUploads slept 100ms and assumed the uploads were waiting on the read
by then. An upload that had not got there yet would find the read gone
and go on without a wake-up, so the tests could pass with the wake-up
missing. It now watches the goroutines' stacks until each upload waits
on readerCountCond, counting out uploads an earlier test left waiting.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Concurrent writers to one file from different mounts require -dlm; without it, a conflicting write fails with EIO and the file may refuse further appends until reopened after the cache drops.