From 5eefdc1e9a732a0315c360a3771f1f3ba68a5294 Mon Sep 17 00:00:00 2001 From: Thomas Lavocat Date: Thu, 9 Feb 2023 17:06:43 +0100 Subject: [PATCH] mounts: add possiblity to use norecovery with ro To avoid kernel panics if the kernel attempts to recover the filesystem when it's mounted as readonly. Offer the possiblity to use the norecovery option for journaling file systems (Xfs, Ext4, Btrfs). --- mounts/org.osbuild.btrfs | 5 +++++ mounts/org.osbuild.ext4 | 5 +++++ mounts/org.osbuild.xfs | 5 +++++ osbuild/mounts.py | 2 ++ 4 files changed, 17 insertions(+) diff --git a/mounts/org.osbuild.btrfs b/mounts/org.osbuild.btrfs index d2387c43..987d184c 100755 --- a/mounts/org.osbuild.btrfs +++ b/mounts/org.osbuild.btrfs @@ -32,6 +32,11 @@ SCHEMA_2 = """ "description": "mount the source as a readonly device", "type": "boolean", "default": false + }, + "norecovery": { + "description": "Don't load the journal on mounting", + "type": "boolean", + "default": false } } } diff --git a/mounts/org.osbuild.ext4 b/mounts/org.osbuild.ext4 index 4b2180b6..74eb58bf 100755 --- a/mounts/org.osbuild.ext4 +++ b/mounts/org.osbuild.ext4 @@ -32,6 +32,11 @@ SCHEMA_2 = """ "description": "mount the source as a readonly device", "type": "boolean", "default": false + }, + "norecovery": { + "description": "Don't load the journal on mounting", + "type": "boolean", + "default": false } } } diff --git a/mounts/org.osbuild.xfs b/mounts/org.osbuild.xfs index 33446efb..1e294325 100755 --- a/mounts/org.osbuild.xfs +++ b/mounts/org.osbuild.xfs @@ -32,6 +32,11 @@ SCHEMA_2 = """ "description": "mount the source as a readonly device", "type": "boolean", "default": false + }, + "norecovery": { + "description": "Don't load the journal on mounting", + "type": "boolean", + "default": false } } } diff --git a/osbuild/mounts.py b/osbuild/mounts.py index 6da9d63d..1d3cb5fd 100644 --- a/osbuild/mounts.py +++ b/osbuild/mounts.py @@ -129,6 +129,8 @@ class FileSystemMountService(MountService): opts = [] if options.get("readonly"): opts.append("ro") + if options.get("norecovery"): + opts.append("norecovery") if "uid" in options: opts.append(f"uid={options['uid']}") if "gid" in options: