Fix remove subvolumes error on brtfs during installation

Current blivet didn't invoke the default subvolume during
brtfs mounting, it lead to the higher level subvolume cannot be removed.

Solution:
Backport upstream patch to fix this issue.
    * 0b672ff4 Make sure we mount the top level subvolume
               when mounting btrfs

Link: 0b672ff452
Reference: bsn#313
Change-Id: If96ad4b7565a332f339734c939e5cf657627d20b
Signed-off-by: Chenxi Mao <chenxi.mao@suse.com>
This commit is contained in:
Chenxi Mao 2022-07-28 21:17:08 +08:00
parent 76f680ebc4
commit a47ebf0c37
2 changed files with 41 additions and 1 deletions

View File

@ -0,0 +1,36 @@
From 0b672ff4527ccbb7b7527f1ab2394fa36738b27f Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Thu, 27 Jan 2022 17:53:06 +0100
Subject: [PATCH 1/1] Make sure we mount the top level subvolume when mounting
btrfs
If we don't specify the subvolid=5 we end up mounting the default
subvolume and if it isn't the top volume one, we can't remove
other subvolumes "higher" in the hierarchy.
This makes the installer crash when reinstalling over a preexisting
btrfs installation, for example the default openSUSE installation
where the default subvolume is a post installation snapshot.
Resolves: rhbz#2026205
---
blivet/devices/btrfs.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/blivet/devices/btrfs.py b/blivet/devices/btrfs.py
index 3b9374fc..6629ba95 100644
--- a/blivet/devices/btrfs.py
+++ b/blivet/devices/btrfs.py
@@ -123,7 +123,8 @@ class BTRFSDevice(StorageDevice):
else:
tmpdir = tempfile.mkdtemp(prefix=self._temp_dir_prefix)
try:
- util.mount(device=fmt.device, mountpoint=tmpdir, fstype=fmt.type)
+ util.mount(device=fmt.device, mountpoint=tmpdir, fstype=fmt.type,
+ options=fmt.mountopts)
except errors.FSError as e:
log.debug("btrfs temp mount failed: %s", e)
raise
--
2.33.0

View File

@ -3,7 +3,7 @@
Name: python-blivet
Version: 3.4.2
Release: 1
Release: 2
Epoch: 1
Summary: A python module for system storage configuration
License: LGPLv2+
@ -20,6 +20,7 @@ BuildRequires: python2-devel python2-setuptools
Patch0: 0001-force-lvm-plugin.patch
Patch1: fix-the-long-hostname.patch
Patch9000: fix-allocate-partitions-threw-exception-when-raid.patch
Patch9001: 0001-Make-sure-we-mount-the-top-level-subvolume-when-moun.patch
@ -122,6 +123,9 @@ make PYTHON=%{__python2} DESTDIR=%{buildroot} install
%doc README.md
%changelog
* Thu Jul 28 2022 Chenxi Mao <chenxi.mao@suse.com> - 3.4.2-2
- Fix remove subvolumes error on brtfs during installation.
* Wed Dec 15 2021 yangcheng <yangcheng87@huawei.com> - 3.4.2-1
- DESC:Upgrade to 3.4.2