coreos / torus

Torus Distributed Storage
https://coreos.com/blog/torus-distributed-storage-by-coreos.html
Apache License 2.0
1.77k stars 172 forks source link

tcmu: call close when OpenTCMUDevice returns error #417

Open nak3 opened 7 years ago

nak3 commented 7 years ago

This patch needs to wait for upstream (go-tcmu)'s fix, since OpenTCMUDevice() doesn't return device currently. (c.f device.go)

lpabon commented 7 years ago

Why is this patch needed? What is it resolving? Normally you do not want to close something which was not created. Some functions return nil, so this could would panic in that situation.

nak3 commented 7 years ago

This fix needs to wait for go-tcmu's fix https://github.com/coreos/go-tcmu/pull/8/files (I commented it above.). And it will never return nil nor cause panic.

The reason why this patch needed is that preEnableTcmu() in go-tcmu creates the device directories. So, if preEnableTcmu() was called but Close() was not called, the directories would remain. Then, restart process will fail.