public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Vojtech Trefny <vtrefny@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/python-blivet] rawhide: Fix default mount options for NTFS and Flush RAID member caches after creating a format
Date: Thu, 24 Sep 2026 13:09:49 GMT	[thread overview]
Message-ID: <179025538933.1.15449721597169757853.rpms-python-blivet-e321ef293909@fedoraproject.org> (raw)

A new commit has been pushed.

Repo   : rpms/python-blivet
Branch : rawhide
Commit : e321ef2939091c48ad24296204b32f8947c91b09
Author : Vojtech Trefny <vtrefny@redhat.com>
Date   : 2026-09-24T14:39:15+02:00
Stats  : +123/-1 in 3 file(s)
URL    : https://src.fedoraproject.org/rpms/python-blivet/c/e321ef2939091c48ad24296204b32f8947c91b09?branch=rawhide

Log:
Fix default mount options for NTFS and Flush RAID member caches after creating a format

---
diff --git a/0002-Flush-RAID-member-caches-after-creating-a-format.patch b/0002-Flush-RAID-member-caches-after-creating-a-format.patch
new file mode 100644
index 0000000..3c4f88b
--- /dev/null
+++ b/0002-Flush-RAID-member-caches-after-creating-a-format.patch
@@ -0,0 +1,92 @@
+From d08b3d34a07206f591026e82be094c17115f8dff Mon Sep 17 00:00:00 2001
+From: Vojtech Trefny <vtrefny@redhat.com>
+Date: Fri, 18 Sep 2026 16:47:36 +0200
+Subject: [PATCH] Flush RAID member caches after creating a format
+
+A filesystem written to a partition of an MD RAID array is written
+through the array, and thus to the member block devices, via bios that
+bypass the members' own page caches. Those member caches -- and the
+whole-array cache -- are separate address_space objects that the kernel
+does not keep coherent with writes made through the partition device.
+
+Stale pages left in a member's page cache while scanning or tearing down
+the previous on-disk layout can therefore be written back over a newly
+created filesystem and corrupt it. This was observed reproducibly on an
+Intel IMSM firmware RAID0 (data offset 0, 16 KiB chunk): after mkfs the
+/boot XFS was valid on disk, but during the payload copy the AG 0 free
+list sector reverted to the previous install's grub core.img bytes,
+leaving /boot unmountable. Flushing the array and partition caches did
+not help because the corrupting pages lived in the member caches, which
+md writes never invalidate.
+
+Invalidate the whole array and its member disks right after the format
+has been written so those stale pages cannot be flushed back over it.
+
+Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
+---
+ blivet/deviceaction.py    |  2 ++
+ blivet/devices/storage.py | 38 ++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 40 insertions(+)
+
+diff --git a/blivet/deviceaction.py b/blivet/deviceaction.py
+index 4690a83e1..dedacd4ab 100644
+--- a/blivet/deviceaction.py
++++ b/blivet/deviceaction.py
+@@ -675,6 +675,8 @@ def execute(self, callbacks=None):
+         self.device.format.create(device=self.device.path,
+                                   options=self.device.format_args)
+ 
++        self.device.post_create_format()
++
+         # Get the UUID now that the format is created
+         udev.settle()
+         self.device.update_sysfs_path()
+diff --git a/blivet/devices/storage.py b/blivet/devices/storage.py
+index 391a59750..2a9b651d8 100644
+--- a/blivet/devices/storage.py
++++ b/blivet/devices/storage.py
+@@ -535,6 +535,44 @@ def _post_create(self):
+ 
+         self._update_netdev_mount_option()
+ 
++    def flush_buffers(self):
++        """ Flush the buffer cache for this device. """
++        if not self.exists:
++            return
++
++        try:
++            util.run_program(["blockdev", "--flushbufs", self.path])
++        except OSError as e:
++            log.warning("failed to flush buffers on %s: %s", self.path, str(e))
++
++    def post_create_format(self):
++        """ Perform actions after a new format has been created on this device.
++
++            A filesystem written to a partition of an MD RAID array is written
++            through the array (and thus the member block devices) via bios that
++            bypass the members' own page caches. Those member caches, and the
++            whole-array cache, are separate address_space objects that the
++            kernel does not keep coherent with writes made through the partition
++            device. Stale pages left in a member's cache while scanning or
++            tearing down the previous on-disk layout can later be flushed back
++            over the newly created format and corrupt it. Flush the buffers of
++            the whole array and its member disks now that the format has been
++            written.
++        """
++        md_types = ("mdarray", "mdcontainer", "mdbiosraidarray")
++        devices = set()
++        for ancestor in self.ancestors:
++            if ancestor.type in md_types:
++                devices.add(ancestor)
++                devices.update(ancestor.members)
++
++        if not devices:
++            return
++
++        devices.add(self)
++        for device in devices:
++            device.flush_buffers()
++
+     #
+     # destroy
+     #

diff --git a/0003-Fix-default-mount-options-for-NTFS.patch b/0003-Fix-default-mount-options-for-NTFS.patch
new file mode 100644
index 0000000..7a858f3
--- /dev/null
+++ b/0003-Fix-default-mount-options-for-NTFS.patch
@@ -0,0 +1,23 @@
+From da1a021436077bc0e7e4a538b6ba5b46c4fba965 Mon Sep 17 00:00:00 2001
+From: Vojtech Trefny <vtrefny@redhat.com>
+Date: Tue, 22 Sep 2026 16:20:59 +0200
+Subject: [PATCH] Fix default mount options for NTFS
+
+"default" isn't a valid option, "defaults" is.
+---
+ blivet/tasks/fsmount.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/blivet/tasks/fsmount.py b/blivet/tasks/fsmount.py
+index 6bcefe9d7..374cf5937 100644
+--- a/blivet/tasks/fsmount.py
++++ b/blivet/tasks/fsmount.py
+@@ -177,7 +177,7 @@ def _availability_errors(self):
+ 
+ 
+ class NTFSMount(FSMount):
+-    options = ["default", "ro"]
++    options = ["defaults", "ro"]
+ 
+ 
+ class SELinuxFSMount(NoDevFSMount):

diff --git a/python-blivet.spec b/python-blivet.spec
index 6ccf7e2..efd784d 100644
--- a/python-blivet.spec
+++ b/python-blivet.spec
@@ -5,7 +5,7 @@ Version: 3.14.2
 
 #%%global prerelease .b2
 # prerelease, if defined, should be something like .a1, .b1, .b2.dev1, or .c2
-Release: 1%{?prerelease}%{?dist}
+Release: 2%{?prerelease}%{?dist}
 Epoch: 1
 License: LGPL-2.1-or-later
 %global realname blivet
@@ -17,6 +17,9 @@ Source1: http://github.com/storaged-project/blivet/releases/download/%{realname}
 Patch0: 0001-remove-btrfs-plugin.patch
 %endif
 
+Patch1: 0002-Flush-RAID-member-caches-after-creating-a-format.patch
+Patch2: 0003-Fix-default-mount-options-for-NTFS.patch
+
 # Versions of required components (done so we make sure the buildrequires
 # match the requires versions of things).
 %global partedver 1.8.1
@@ -133,6 +136,10 @@ make DESTDIR=%{buildroot} install
 %{python3_sitelib}/*
 
 %changelog
+* Thu Sep 24 2026 Vojtech Trefny <vtrefny@redhat.com> - 1:3.14.2-2
+- Fix default mount options for NTFS
+- Flush RAID member caches after creating a format (#2530897)
+
 * Mon Sep 14 2026 Packit <hello@packit.dev> - 1:3.14.2-1
 - Update to version 3.14.2
 

                 reply	other threads:[~2026-09-24 13:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179025538933.1.15449721597169757853.rpms-python-blivet-e321ef293909@fedoraproject.org \
    --to=vtrefny@redhat.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox