neil / rpms / udisks2

Forked from rpms/udisks2 a year ago
Clone
8ae392
From 2d5d2b7570b0f44c14b34b5dc831f174205c10f2 Mon Sep 17 00:00:00 2001
8ae392
From: Tomas Bzatek <tbzatek@redhat.com>
8ae392
Date: Wed, 15 Sep 2021 14:34:49 +0200
8ae392
Subject: [PATCH] mount options: Always use errors=remount-ro for ext
8ae392
 filesystems
8ae392
8ae392
Default mount options are focused primarily on data safety, mounting
8ae392
damaged ext2/3/4 filesystem as readonly would indicate something's wrong.
8ae392
---
8ae392
 data/builtin_mount_options.conf            | 9 +++++++++
8ae392
 src/tests/dbus-tests/test_80_filesystem.py | 6 ++++++
8ae392
 2 files changed, 15 insertions(+)
8ae392
8ae392
diff --git a/data/builtin_mount_options.conf b/data/builtin_mount_options.conf
8ae392
index 37715cfa4..e0bd0ee1f 100644
8ae392
--- a/data/builtin_mount_options.conf
8ae392
+++ b/data/builtin_mount_options.conf
8ae392
@@ -27,3 +27,12 @@ f2fs_allow=discard,nodiscard,compress_algorithm,compress_log_size,compress_exten
8ae392
 btrfs_allow=compress,compress-force,datacow,nodatacow,datasum,nodatasum,degraded,device,discard,nodiscard,subvol,subvolid,space_cache
8ae392
 
8ae392
 f2fs_allow=discard,nodiscard,compress_algorithm,compress_log_size,compress_extension,alloc_mode
8ae392
+
8ae392
+ext2_defaults=errors=remount-ro
8ae392
+ext2_allow=errors=remount-ro
8ae392
+
8ae392
+ext3_defaults=errors=remount-ro
8ae392
+ext3_allow=errors=remount-ro
8ae392
+
8ae392
+ext4_defaults=errors=remount-ro
8ae392
+ext4_allow=errors=remount-ro
8ae392
diff --git a/src/tests/dbus-tests/test_80_filesystem.py b/src/tests/dbus-tests/test_80_filesystem.py
8ae392
index 019880f57..2d1933240 100644
8ae392
--- a/src/tests/dbus-tests/test_80_filesystem.py
8ae392
+++ b/src/tests/dbus-tests/test_80_filesystem.py
8ae392
@@ -321,6 +321,8 @@ def test_mount_auto(self):
8ae392
         _ret, out = self.run_command('mount | grep %s' % block_fs_dev)
8ae392
         self.assertIn(mnt_path, out)
8ae392
         self.assertIn('ro', out)
8ae392
+        if self._fs_name.startswith('ext'):
8ae392
+            self.assertIn('errors=remount-ro', out)
8ae392
 
8ae392
         # dbus mountpoint
8ae392
         dbus_mounts = self.get_property(block_fs, '.Filesystem', 'MountPoints')
8ae392
@@ -478,6 +480,10 @@ def test_custom_option(self, should_fail, dbus_option, should_be_present, config
8ae392
         if self._fs_name == "udf":
8ae392
             test_custom_option(self, False, None, False, "[defaults]\ndefaults=\nallow=exec,noexec,nodev,nosuid,atime,noatime,nodiratime,ro,rw,sync,dirsync,noload,uid=ignore,uid=forget\n")
8ae392
             test_custom_option(self, True, "uid=notallowed", True, "[defaults]\nallow=exec,noexec,nodev,nosuid,atime,noatime,nodiratime,ro,rw,sync,dirsync,noload,uid=ignore\n")
8ae392
+        if self._fs_name.startswith("ext"):
8ae392
+            test_custom_option(self, False, "errors=remount-ro", True, "", match_mount_option="errors=remount-ro")
8ae392
+            test_custom_option(self, True, "errors=panic", False, "")
8ae392
+            test_custom_option(self, True, "errors=continue", False, "")
8ae392
 
8ae392
         # udev rules overrides
8ae392
         test_readonly(self, False, "", udev_rules_content = { "UDISKS_MOUNT_OPTIONS_DEFAULTS": "rw" })