File 0001-mount-options-Always-use-errors-remount-ro-for-ext-f.patch of Package udisks2.24163

From 2d5d2b7570b0f44c14b34b5dc831f174205c10f2 Mon Sep 17 00:00:00 2001
From: Tomas Bzatek <tbzatek@redhat.com>
Date: Wed, 15 Sep 2021 14:34:49 +0200
Subject: [PATCH] mount options: Always use errors=remount-ro for ext
 filesystems

Default mount options are focused primarily on data safety, mounting
damaged ext2/3/4 filesystem as readonly would indicate something's wrong.
---
 data/builtin_mount_options.conf            | 9 +++++++++
 src/tests/dbus-tests/test_80_filesystem.py | 6 ++++++
 2 files changed, 15 insertions(+)

diff --git a/data/builtin_mount_options.conf b/data/builtin_mount_options.conf
index 37715cfa..e0bd0ee1 100644
--- a/data/builtin_mount_options.conf
+++ b/data/builtin_mount_options.conf
@@ -27,3 +27,12 @@ f2fs_allow=discard,nodiscard,compress_algorithm,compress_log_size,compress_exten
 xfs_allow=discard,nodiscard,inode32,largeio,wsync
 
 reiserfs_allow=hashed_relocation,no_unhashed_relocation,noborder,notail
+
+ext2_defaults=errors=remount-ro
+ext2_allow=errors=remount-ro
+
+ext3_defaults=errors=remount-ro
+ext3_allow=errors=remount-ro
+
+ext4_defaults=errors=remount-ro
+ext4_allow=errors=remount-ro
diff --git a/src/tests/dbus-tests/test_80_filesystem.py b/src/tests/dbus-tests/test_80_filesystem.py
index 019880f5..2d193324 100644
--- a/src/tests/dbus-tests/test_80_filesystem.py
+++ b/src/tests/dbus-tests/test_80_filesystem.py
@@ -321,6 +321,8 @@ class UdisksFSTestCase(udiskstestcase.UdisksTestCase):
         _ret, out = self.run_command('mount | grep %s' % block_fs_dev)
         self.assertIn(mnt_path, out)
         self.assertIn('ro', out)
+        if self._fs_name.startswith('ext'):
+            self.assertIn('errors=remount-ro', out)
 
         # dbus mountpoint
         dbus_mounts = self.get_property(block_fs, '.Filesystem', 'MountPoints')
@@ -478,6 +480,10 @@ class UdisksFSTestCase(udiskstestcase.UdisksTestCase):
         if self._fs_name == "udf":
             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")
             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")
+        if self._fs_name.startswith("ext"):
+            test_custom_option(self, False, "errors=remount-ro", True, "", match_mount_option="errors=remount-ro")
+            test_custom_option(self, True, "errors=panic", False, "")
+            test_custom_option(self, True, "errors=continue", False, "")
 
         # udev rules overrides
         test_readonly(self, False, "", udev_rules_content = { "UDISKS_MOUNT_OPTIONS_DEFAULTS": "rw" })
-- 
2.35.3

openSUSE Build Service is sponsored by