#1070354 lvm2: fsck'ing a snapshot (like e2scrub does) of a cached volume can destroy the filesystem

Package:
lvm2
Source:
lvm2
Description:
Linux Logical Volume Manager
Submitter:
Alex Volkov
Date:
2024-05-04 19:54:03 UTC
Severity:
normal
#1070354#5
Date:
2024-05-04 12:06:48 UTC
From:
To:
Dear Maintainer,

snapshots of cached volumes seem to be seriously broken
(maybe it's fixed in the latest upstream version, I'm not sure).

To see the issue, try the following:

* create a cached volume, make a ext4 filesystem in it, mount it, and put some
  contents there so the FS isn't empty;

* start some process making changes to the volume (like cyclically copying
files etc,
  which imitates a busy filesystem);

* create a snapshot of the volume;

* try to check the snapshot with fsck.

With non-zero probability you will get filesystem errors on the snapshot.
(Note that if you do the same on a non-cached volume the check passes
as it should.) Trying to fix the errors automatically and then removing
the snapshot will most likely lead to the ruined filesystem on the volume.

I learned this the hard way when I tried to e2scrub my cached /home partition.
Granted, I have backups...

#1070354#10
Date:
2024-05-04 19:13:02 UTC
From:
To: