neil / rpms / udisks2

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