siderolabs / go-blockdevice

Mozilla Public License 2.0
18 stars 14 forks source link

add a shared lock when probing a device #83

Closed smira closed 6 months ago

smira commented 8 months ago

This prevents probing a device which is being locked because something is working on it.

Similar to https://github.com/siderolabs/go-blockdevice/blob/d9313ea908f3790dba29f7432501335825c863ff/blockdevice/blockdevice_linux.go#L79-L85, but with LOCK_SH.

If the lock fails, return an error which can be tested for, so that Talos can retry probing later.