fix: wake hydration callers on close while retaining physical I/O ownership

This commit is contained in:
pingqiu committed 2026-11-19 16:02:10 -08:00
1 parent d2d9ce4ac9
commit 074b7cc0ea
2 files changed
+12 -1

No files matched your search

@@ -88,6 +88,11 @@ func (l *chunkLayerImpl) OnReadMissContext(ctx context.Context, lba uint64) ([]b
hook(idx)
}
select {
case <-l.ctx.Done():
l.stMu.Lock()
f.waiters--
l.stMu.Unlock()
return nil, errChunkLayerClosed
case <-f.done:
case <-ctx.Done():
// A completed fault wins a simultaneous caller deadline.
+7 -1
View File
@@ -1048,9 +1048,15 @@ func (s *WALStore) WriteInstrumentation() WriteInstrumentationStatus {
// from the WAL; clean LBAs are served from the extent.
func (s *WALStore) Read(lba uint32) ([]byte, error) { return s.ReadContext(context.Background(), lba) }
func (s *WALStore) ReadContext(ctx context.Context, lba uint32) ([]byte, error) {
func (s *WALStore) ReadContext(ctx context.Context, lba uint32) (data []byte, err error) {
ctx, cancel := context.WithTimeout(ctx, defaultHydrationWait)
defer cancel()
defer func() {
if err == nil && ctx.Err() != nil {
data = nil
err = hydrationPending(ctx.Err())
}
}()
if err := ctx.Err(); err != nil {
return nil, hydrationPending(err)
}