blivet: backport rhbz#1170803 fix
It disable fsck for all partitions call. Fixes QubesOS/qubes-issues#2835
This commit is contained in:
parent
3acd47647e
commit
285a218ed7
@ -0,0 +1,44 @@
|
|||||||
|
From a43dc757eff7fe9417f72e25fc373d09439963de Mon Sep 17 00:00:00 2001
|
||||||
|
From: Vratislav Podzimek <vpodzime@redhat.com>
|
||||||
|
Date: Fri, 18 Nov 2016 14:01:49 +0100
|
||||||
|
Subject: [PATCH 1/2] Change how we run e2fsck to check ext filesystems
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
The '-p' option means "Automatically repair ("preen") the file system. This
|
||||||
|
option will cause e2fsck to automatically fix any filesystem problems that can
|
||||||
|
be safely fixed without human intervention." which is something we really
|
||||||
|
shouldn't do as part of reset()/populate(). We should use '-n' instead "Open the
|
||||||
|
filesystem read-only, and assume an answer of `no' to all questions." which
|
||||||
|
guaranties no changes to be made on the file system.
|
||||||
|
|
||||||
|
We might want to add the '-p' functionality back at some point, but it needs to
|
||||||
|
be explicitly triggered by the user code (e.g. Anaconda). I think we need to add
|
||||||
|
a 'clean' property and a 'repair' method to the formats.FS class so that users
|
||||||
|
can see where the problem is (if any) and explicitly trigger a safe fixup
|
||||||
|
attempt if they want to.
|
||||||
|
|
||||||
|
Related: rhbz#1170803
|
||||||
|
---
|
||||||
|
blivet/tasks/fsck.py | 4 +++-
|
||||||
|
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/blivet/tasks/fsck.py b/blivet/tasks/fsck.py
|
||||||
|
index a3ed775..c4214dc 100644
|
||||||
|
--- a/blivet/tasks/fsck.py
|
||||||
|
+++ b/blivet/tasks/fsck.py
|
||||||
|
@@ -114,7 +114,9 @@ class Ext2FSCK(FSCK):
|
||||||
|
128: "Shared library error."}
|
||||||
|
|
||||||
|
ext = availability.E2FSCK_APP
|
||||||
|
- options = ["-f", "-p", "-C", "0"]
|
||||||
|
+ # "Force checking even if the file system seems clean." (we might get false results otherwise)
|
||||||
|
+ # + "Open the filesystem read-only, and assume an answer of `no' to all questions."
|
||||||
|
+ options = ["-f", "-n"]
|
||||||
|
|
||||||
|
def _error_message(self, rc):
|
||||||
|
msgs = (self._fsck_errors[c] for c in self._fsck_errors.keys() if rc & c)
|
||||||
|
--
|
||||||
|
2.7.5
|
||||||
|
|
@ -0,0 +1,84 @@
|
|||||||
|
From 32ba44edfa5cd4424154396b877cd5ad75e8c999 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Vratislav Podzimek <vpodzime@redhat.com>
|
||||||
|
Date: Tue, 22 Nov 2016 08:52:34 +0100
|
||||||
|
Subject: [PATCH 2/2] Do not run FS check as part of updating (re)size info
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
If the FS tools tell us the minimum size of the file system we are supposed to
|
||||||
|
(see rhbz#1170803) consider that an evidence of the file system being in a good
|
||||||
|
enough shape to be resized.
|
||||||
|
|
||||||
|
Resolves: rhbz#1170803
|
||||||
|
---
|
||||||
|
blivet/formats/fs.py | 44 ++++++++++++++++++--------------------------
|
||||||
|
1 file changed, 18 insertions(+), 26 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/blivet/formats/fs.py b/blivet/formats/fs.py
|
||||||
|
index 203926e..100bfce 100644
|
||||||
|
--- a/blivet/formats/fs.py
|
||||||
|
+++ b/blivet/formats/fs.py
|
||||||
|
@@ -296,8 +296,6 @@ class FS(DeviceFormat):
|
||||||
|
""" Update this filesystem's current and minimum size (for resize). """
|
||||||
|
|
||||||
|
# This method ensures:
|
||||||
|
- # * If there are fsck errors, self._resizable is False.
|
||||||
|
- # Note that if there is no fsck program, no errors are possible.
|
||||||
|
# * If it is not possible to obtain the current size of the
|
||||||
|
# filesystem by interrogating the filesystem, self._resizable
|
||||||
|
# is False (and self._size is 0).
|
||||||
|
@@ -317,32 +315,26 @@ class FS(DeviceFormat):
|
||||||
|
self._min_instance_size = Size(0)
|
||||||
|
self._resizable = self.__class__._resizable
|
||||||
|
|
||||||
|
- # We can't allow resize if the filesystem has errors.
|
||||||
|
+ # try to gather current size info
|
||||||
|
+ self._size = Size(0)
|
||||||
|
try:
|
||||||
|
- self.do_check()
|
||||||
|
- except FSError:
|
||||||
|
+ if self._info.available:
|
||||||
|
+ self._current_info = self._info.do_task()
|
||||||
|
+ except FSError as e:
|
||||||
|
+ log.info("Failed to obtain info for device %s: %s", self.device, e)
|
||||||
|
+ try:
|
||||||
|
+ self._size = self._size_info.do_task()
|
||||||
|
+ except (FSError, NotImplementedError) as e:
|
||||||
|
+ log.warning("Failed to obtain current size for device %s: %s", self.device, e)
|
||||||
|
+ else:
|
||||||
|
+ self._min_instance_size = self._size
|
||||||
|
+
|
||||||
|
+ # We absolutely need a current size to enable resize. To shrink the
|
||||||
|
+ # filesystem we need a real minimum size provided by the resize
|
||||||
|
+ # tool. Failing that, we can default to the current size,
|
||||||
|
+ # effectively disabling shrink.
|
||||||
|
+ if self._size == Size(0):
|
||||||
|
self._resizable = False
|
||||||
|
- raise
|
||||||
|
- finally:
|
||||||
|
- # try to gather current size info anyway
|
||||||
|
- self._size = Size(0)
|
||||||
|
- try:
|
||||||
|
- if self._info.available:
|
||||||
|
- self._current_info = self._info.do_task()
|
||||||
|
- except FSError as e:
|
||||||
|
- log.info("Failed to obtain info for device %s: %s", self.device, e)
|
||||||
|
- try:
|
||||||
|
- self._size = self._size_info.do_task()
|
||||||
|
- self._min_instance_size = self._size
|
||||||
|
- except (FSError, NotImplementedError) as e:
|
||||||
|
- log.warning("Failed to obtain current size for device %s: %s", self.device, e)
|
||||||
|
-
|
||||||
|
- # We absolutely need a current size to enable resize. To shrink the
|
||||||
|
- # filesystem we need a real minimum size provided by the resize
|
||||||
|
- # tool. Failing that, we can default to the current size,
|
||||||
|
- # effectively disabling shrink.
|
||||||
|
- if self._size == Size(0):
|
||||||
|
- self._resizable = False
|
||||||
|
|
||||||
|
try:
|
||||||
|
result = self._minsize.do_task()
|
||||||
|
--
|
||||||
|
2.7.5
|
||||||
|
|
@ -23,6 +23,8 @@ Patch2: 0003-iSCSI-turn-iscsi.initiator_set-into-a-property.patch
|
|||||||
Patch3: 0004-Add-device-symlinks-to-the-PVs-dictionary-for-MD-RAI.patch
|
Patch3: 0004-Add-device-symlinks-to-the-PVs-dictionary-for-MD-RAI.patch
|
||||||
Patch4: 0001-Fix-detection-of-macefi-partitions-1393846.patch
|
Patch4: 0001-Fix-detection-of-macefi-partitions-1393846.patch
|
||||||
Patch5: 0001-Fix-unknown-SAS-device-sysfs-parsing.patch
|
Patch5: 0001-Fix-unknown-SAS-device-sysfs-parsing.patch
|
||||||
|
Patch6: 0001-Change-how-we-run-e2fsck-to-check-ext-filesystems.patch
|
||||||
|
Patch7: 0002-Do-not-run-FS-check-as-part-of-updating-re-size-info.patch
|
||||||
|
|
||||||
# Versions of required components (done so we make sure the buildrequires
|
# Versions of required components (done so we make sure the buildrequires
|
||||||
# match the requires versions of things).
|
# match the requires versions of things).
|
||||||
@ -78,6 +80,8 @@ configuration.
|
|||||||
%patch3 -p1
|
%patch3 -p1
|
||||||
%patch4 -p1
|
%patch4 -p1
|
||||||
%patch5 -p1
|
%patch5 -p1
|
||||||
|
%patch6 -p1
|
||||||
|
%patch7 -p1
|
||||||
|
|
||||||
rm -rf %{py3dir}
|
rm -rf %{py3dir}
|
||||||
cp -a . %{py3dir}
|
cp -a . %{py3dir}
|
||||||
|
Loading…
Reference in New Issue
Block a user