Skip to content

Commit

Permalink
fix: ignore 'no such device' in addition to 'no such file'
Browse files Browse the repository at this point in the history
This errors pops up when `udevd` rescans the partition table with Talos
trying to mount a device concurrently.

This feels to be something new with Linux 6.6 probably.

Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
  • Loading branch information
smira committed Feb 26, 2024
1 parent 1cb5443 commit 8872a7a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
14 changes: 11 additions & 3 deletions cmd/installer/pkg/install/install.go
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/siderolabs/go-blockdevice/blockdevice"
"github.com/siderolabs/go-procfs/procfs"
"github.com/siderolabs/go-retry/retry"
"golang.org/x/sys/unix"

"github.com/siderolabs/talos/internal/app/machined/pkg/runtime"
"github.com/siderolabs/talos/internal/app/machined/pkg/runtime/v1alpha1/board"
Expand Down Expand Up @@ -377,11 +378,18 @@ func retryBlockdeviceOpen(device string) (*blockdevice.BlockDevice, error) {
var openErr error

bd, openErr = blockdevice.Open(device)
if openErr != nil && os.IsNotExist(openErr) {
return retry.ExpectedError(openErr)
if openErr == nil {
return nil
}

return openErr
switch {
case os.IsNotExist(openErr):
return retry.ExpectedError(openErr)
case errors.Is(openErr, unix.ENODEV):
return retry.ExpectedError(openErr)
default:
return nil
}
})

return bd, err
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/mount/mount.go
Expand Up @@ -148,7 +148,7 @@ func mountRetry(f RetryFunc, p *Point, isUnmount bool) (err error) {
switch err {
case unix.EBUSY:
return retry.ExpectedError(err)
case unix.ENOENT:
case unix.ENOENT, unix.ENODEV:
// if udevd triggers BLKRRPART ioctl, partition device entry might disappear temporarily
return retry.ExpectedError(err)
case unix.EUCLEAN:
Expand Down

0 comments on commit 8872a7a

Please sign in to comment.