From 1052556f49a5ea76d17bd86f0ed5a28fb195f5c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20Wanzenb=C3=B6ck?= Date: Mon, 23 Dec 2024 13:40:33 +0100 Subject: [PATCH] disable fallback to RO mounts for RW volumes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- CHANGELOG.md | 4 ++++ pkg/client/linstor.go | 3 +++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 72d127e..f032c3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/pkg/client/linstor.go b/pkg/client/linstor.go index c0abc1b..7cd7f4d 100644 --- a/pkg/client/linstor.go +++ b/pkg/client/linstor.go @@ -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 {