5
0
mirror of git://git.proxmox.com/git/pve-storage.git synced 2025-01-11 05:18:01 +03:00

add workaround for zfs rollback bug

as described in the zfs bug https://github.com/openzfs/zfs/issues/10931
the kernel keeps around cached data from mmaps after a rollback, thus
having invalid data in files that were allegedly rolled back

to workaround this (until a real fix comes along), we unmount the subvol,
invalidating the kernel cache anyway

the dataset gets mounted on the next 'activate_volume' again

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2021-01-21 16:47:59 +01:00 committed by Thomas Lamprecht
parent d3a5e30963
commit 26a8f21ab2

View File

@ -467,9 +467,18 @@ sub volume_snapshot_delete {
sub volume_snapshot_rollback {
my ($class, $scfg, $storeid, $volname, $snap) = @_;
my $vname = ($class->parse_volname($volname))[1];
my (undef, $vname, undef, undef, undef, undef, $format) = $class->parse_volname($volname);
$class->zfs_request($scfg, undef, 'rollback', "$scfg->{pool}/$vname\@$snap");
my $msg = $class->zfs_request($scfg, undef, 'rollback', "$scfg->{pool}/$vname\@$snap");
# we have to unmount rollbacked subvols, to invalidate wrong kernel
# caches, they get mounted in activate volume again
# see zfs bug #10931 https://github.com/openzfs/zfs/issues/10931
if ($format eq 'subvol') {
$class->zfs_request($scfg, undef, 'unmount', "$scfg->{pool}/$vname");
}
return $msg;
}
sub volume_rollback_is_possible {