fix: race with udevd and mountUserDisks

Fixes #7246

The problem was that `udevd` watches via `inotify` any attempts to open
blockdevices with 'write' access.

Talos was opening with write access, but actually accessing as
read-only, so the fix is to open as read-only.

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
This commit is contained in:
Andrey Smirnov 2023-05-19 21:56:49 +04:00
parent c3fabb9829
commit ff11fd39c7
No known key found for this signature in database
GPG Key ID: 7B26396447AB6DFD

View File

@ -1037,7 +1037,7 @@ func partitionAndFormatDisks(logger *log.Logger, r runtime.Runtime) error {
disk := disk
if err := func() error {
bd, err := blockdevice.Open(disk.Device())
bd, err := blockdevice.Open(disk.Device(), blockdevice.WithMode(blockdevice.ReadonlyMode))
if err != nil {
return err
}