Bug originally reported at http://www.redhat.com/archives/dm-devel/2013-March/msg00033.html , problem relates to issuing the BLKDISCARD ioctl to a thin volume. If I create a thin volume, fill it with data, snapshot it, then call BLKDISCARD on the thin volume, it looks like the kernel doesn't take into account the fact that the underlying blocks are shared with the snapshot, and just goes ahead and discards them. This appears to then leave the metadata in an inconsistent state.
Fix at https://github.com/jthornber/linux-2.6/commit/a42dfef751cb666d3274346c07dff655cb40cc5a ("Fix a bug in dm_btree_remove that could leave leaf values with incorrect reference counts").
Are we going add 'workaround' support for this issue in lvm2 tools - to disable usage of discard for thinp targets prior some specific version ?
If so - how do we detect target with this bug - will there be version number increase?