Re: [dm-devel] LVM snapshot broke between 4.14 and 4.16

From: Alasdair G Kergon
Date: Fri Aug 03 2018 - 15:56:42 EST


On Fri, Aug 03, 2018 at 11:20:34AM -0400, Theodore Y. Ts'o wrote:
> It *used* to be the case that users running RHEL 2 or RHEL 3 could try
> updating to the latest upstream kernel, and everything would break and
> fall apart. This was universally considered to be a failure, and a
> Bad Thing. So if LVM2 is not backwards compatible, and breaks in the
> face of newer kernels running older distributions, that is a bug.

Brings back memories! For those who wonder what this is all about,
with LVM1, if the version of kernel and userspace didn't match it simply
stopped. No booting into the previous version of your kernel after
upgrading unless you reverted userspace as well! Led to all sorts of
not-so-fancy workarounds.

As a reaction to this, LVM2 (through libdevmapper and anything else
using the dm ioctls as documented in dm-ioctl.h) passes a version number
up to the kernel (to say "I know about kernels with dm up to and
including version x.y.z"), so there is an option for an in-kernel
workaround here to limit its compatibility mode to the broken userspace
versions.

Anything passing in version 4.37.0 or earlier (which is the version in
dm-ioctl.h when this kernel patch was applied) could be assumed to
require the old behaviour. check_version() is where this version is
seen, so it would either store it for later checking or do the check and
store a flag to invoke compatible behaviour later.

Alasdair