Skip to content

Commit

Permalink
disable fallback to RO mounts for RW volumes
Browse files Browse the repository at this point in the history
If a user requests a RW volume, we disable the default behaviour of "mount"
to fallback to RO mounts should there be an issue with the initial RW attempt.

This may happen if a DRBD device is in a weird state, where the default
auto-promote does not succeed, but the resource is otherwise fine. A RO mount
does not require an explicit state change, so it may succeed in such a
situation.

By requesting "rw" in the mount options, we prevent this behaviour.

Signed-off-by: Moritz Wanzenböck <[email protected]>
  • Loading branch information
WanzenBug committed Dec 23, 2024
1 parent 888bdf7 commit 1052556
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- Disable `mount` fallback to mount a volume RO even if a RW mount was requested.

## [1.6.4] - 2024-11-08

### Fixed
Expand Down
3 changes: 3 additions & 0 deletions pkg/client/linstor.go
Original file line number Diff line number Diff line change
Expand Up @@ -1963,6 +1963,9 @@ func (s *Linstor) Mount(ctx context.Context, source, target, fsType string, read
return fmt.Errorf("failed to set source device readonly: %w", err)
}
} else {
// Explicitly set rw option: otherwise mount may fall back to RO mount on promotion errors
mntOpts = append(mntOpts, "rw")

// We might be re-using an existing device that was set RO previously
err = s.setDevReadWrite(ctx, source)
if err != nil {
Expand Down

0 comments on commit 1052556

Please sign in to comment.