Skip to content

Commit

Permalink
go/mio: fix hang when motr i/o op returns error (Seagate#1655)
Browse files Browse the repository at this point in the history
When some motr i/o operation returns an error, doIO() just hangs.
It's because due to the bug in the code we return back the same
slot 2 times into the channel pool of free thread slots.

Solution: fix the bug by returning the slot back only 1 time.

Kudos to Sining Wu <sining.wu@seagate.com> for RCA.

Signed-off-by: Andriy Tkachuk <andriy.tkachuk@seagate.com>
  • Loading branch information
andriytk authored Apr 27, 2022
1 parent 47508ca commit c20bdfb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions bindings/go/mio/mio.go
Original file line number Diff line number Diff line change
Expand Up @@ -485,10 +485,11 @@ func (v *iov) doIO(i int, op *C.struct_m0_op) {
C.m0_op_fini(op)
C.m0_op_free(op)
// put the slot back to the pool
err := error(nil)
if rc != 0 {
v.ch <- slot{i, fmt.Errorf("io op (%d) failed: %d", op.op_code, rc)}
err = fmt.Errorf("io op (%d) failed: %d", op.op_code, rc)
}
v.ch <- slot{i, nil}
v.ch <- slot{i, err}
}

func getBW(n int, d time.Duration) (int, string) {
Expand Down

0 comments on commit c20bdfb

Please sign in to comment.