yast / yast-storage-ng

Rewrite of https://github.com/yast/yast-storage
http://yast.github.io/
GNU General Public License v2.0
14 stars 20 forks source link

Prevent setting the Volume Label for a Mounted Btrfs or Swap [SLE-15-SP4] #1340

Closed shundhammer closed 1 year ago

shundhammer commented 1 year ago

Target Branch

This is for SLE-15-SP4. See below for the merge PRs to SLE-15-SP5 and master / Factory.

Bugzilla

L3: https://bugzilla.suse.com/show_bug.cgi?id=1211337

Trello

https://trello.com/c/JvuZVVU3

Problem

Trying to change the volume label of a mounted Btrfs or swap partition in the YaST partitioner fails with an error message

Setting label of btrfs on /dev/sda2 (57.50 GiB) to root Unexpected situation found in the system.

The "Details" button shows

Caught signal #127: "/sbin/btrfs filesystem label '/dev/sda2' 'root'

which is scary and confusing and does not give the user any hint what's actually wrong.

Unexpected_situation

Caught_signal

In the case of a root Btrfs, it even hangs later because subvolumes cannot be mounted.

Cause

Even though some filesystem types do support changing the volume label while mounted, in our context this has implications with the subvolumes. Handling the subvolumes properly very likely requires a very intrusive code change which involves quite some risk.

Fix

So we chose the less intrusive approach to disable it on the UI level: When we detect that the filesystem or swap space is actively mounted, we are now disabling the "Volume Label" field in the "Fstab Options" dialog.

Screenshots

partitioner-btrfs Partitioner with a mounted Btrfs on /dev/sdb1

partitioner-edit Editing /dev/sdb1

btrfs-mounted "Volume Label" field disabled because the filesystem is mounted, so changing it would fail.

partitioner-edit-after-unmount After unmounting, saving the changes and entering the partitioner again, the volume label can now be changed.

Test

Extensive manual tests in a VM with a second virtual disk where partitions can be easily added and changed.

Related PRs

coveralls commented 1 year ago

Coverage Status

coverage: 97.752% (-0.003%) from 97.755% when pulling ae07279b8daded2f2a3580ba9653f23ed37c4f38 on huha-vol-label-sp4 into 1e609c107a158d4cc4c73361aaad4f3f4182352b on master.

shundhammer commented 1 year ago

@aschnell, @ancorgs FYI

yast-bot commented 1 year ago

:heavy_check_mark: Internal Jenkins job #10 successfully finished :heavy_check_mark: Created IBS submit request #300725