Skip to content

Commit e6a004f

Browse files
committed
ipfs: all - fix ReadDir deadlock on EOF/error state
Originally, directory streams were struct values, and a channel field was used to validate if the file was open / not-yet-closed. Eventually, that was changed to be a pointer to struct, which was used as a check condition instead. This invalidator path was never removed, and causes deadlocks if the caller tries to read from a directory which already encountered an error (either `EOF` or any other).
1 parent ab66de0 commit e6a004f

File tree

3 files changed

+0
-3
lines changed

3 files changed

+0
-3
lines changed

internal/filesystem/ipfs/ipfs.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,6 @@ func (id *ipfsDirectory) ReadDir(count int) ([]fs.DirEntry, error) {
499499
)
500500
entries, err := readEntries(ctx, entryChan, count)
501501
if err != nil {
502-
stream.ch = nil
503502
err = readdirErr(op, id.info.name, err)
504503
id.err = err
505504
}

internal/filesystem/ipfs/keyfs.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,6 @@ func (kd *keyDirectory) ReadDir(count int) ([]fs.DirEntry, error) {
203203
}
204204
ents, err := readEntries(ctx, entries, count)
205205
if err != nil {
206-
stream.ch = nil
207206
err = readdirErr(op, filesystem.Root, err)
208207
kd.err = err
209208
}

internal/filesystem/ipfs/pinfs.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,6 @@ func (pd *pinDirectory) ReadDir(count int) ([]fs.DirEntry, error) {
293293
)
294294
entries, err := readEntries(ctx, entryChan, count)
295295
if err != nil {
296-
stream.ch = nil
297296
err = readdirErr(op, filesystem.Root, err)
298297
pd.err = err
299298
}

0 commit comments

Comments
 (0)