Description of problem: We're missing a way to forcibly detach a cachevol if it becomes damaged or invalid, and is unrepairable. We do allow forced detaching with --force if the cachevol is missing devices. We need to allow the forced detach for other kinds of unrepairable damage, and not limit it to the case of missing devices. (A user could work around this by filtering the damaged cache devices, or wiping their headers to make them look missing, and then lvm would allow --force to detach the cache.) In cases where cache devices are lost or unrepairable, the user may want to try to recover data from the origin LV. That data would often be incomplete and in some invalid state itself, because data from the cache was never flushed. In some limited cases the data in the origin may be fine or easily repairable. Forcibly detaching the cache means not trying to activate the LV or flush the cache, both of which fail by definition with a missing or corrupted cache. This forcible detach would generally be done only after repair fails or cache devices are missing altogether. There is no new command, the existing lvconvert --splitcache --force is used, but is now permitted even if the cachevol devices are present. Version-Release number of selected component (if applicable): How reproducible: Steps to Reproduce: 1. 2. 3. Actual results: Expected results: Additional info:
pushed to main branch https://sourceware.org/git/?p=lvm2.git;a=commit;h=cb54d0801d776205788f8f46b31dd9e487833343
Fix verified in the latest rpms. kernel-4.18.0-310.el8 BUILT: Thu May 27 14:24:00 CDT 2021 lvm2-2.03.12-2.el8 BUILT: Tue Jun 1 06:55:37 CDT 2021 lvm2-libs-2.03.12-2.el8 BUILT: Tue Jun 1 06:55:37 CDT 2021 SCENARIO - [verify_writecache_error_attr_after_offline_pool_corruption] Create a snapshot of writecache origin and then verify new (E)rror attribute after OFFLINE pool corruption *** Writecache info for this scenario *** * origin (slow): /dev/sdd1 * pool (fast): /dev/sdi1 ************************************ Adding "slow" and "fast" tags to corresponding pvs Create origin (slow) volume lvcreate --yes --wipesignatures y -L 4G -n cworigin writecache_sanity @slow Create writecache cvol (fast) volumes lvcreate --yes -L 4G -n POOL writecache_sanity @fast Deactivate *ONLY* fast pool before conversion to write cache (SEE bug 1185347) Create writecached volume by combining the cache pool (fast) and origin (slow) volumes lvconvert --yes --type writecache --cachesettings 'low_watermark=21 high_watermark=92 writeback_jobs=1531 autocommit_blocks=1118 autocommit_time=2014' --cachevol writecache_sanity/POOL writecache_sanity/cworigin Placing an XFS filesystem on origin volume Mounting origin volume Writing files to /mnt/cworigin Checking files on /mnt/cworigin Creating thin snapshot of origin volume lvcreate --yes -s /dev/writecache_sanity/cworigin -c 128 -n snap -L 500M Mounting thin snapshot volume and origin mkdir -p /mnt/snap mount -o nouuid /dev/writecache_sanity/snap /mnt/snap Checking files on /mnt/snap dmsetup table | grep writecache_sanity-POOL_cvol Swapping the current pool device table (writecache_sanity-POOL_cvol: 0 8388608 linear 8:129 2048) for an error target dmsetup suspend writecache_sanity-cworigin dmsetup suspend writecache_sanity-POOL_cvol Loading in new pool device table (0 8388608 error 8:129 2048) dmsetup load writecache_sanity-POOL_cvol --table " 0 8388608 error 8:129 2048" dmsetup resume writecache_sanity-POOL_cvol dmsetup resume writecache_sanity-cworigin Attempt --repair on live pool (should fail) lvconvert --yes --repair writecache_sanity/POOL_cvol Command on LV writecache_sanity/POOL_cvol does not accept LV type linear. Command not permitted on LV writecache_sanity/POOL_cvol. Attempt to split off write cache pool (should spin and cause the (E)rror state mentioned in bug 1805893) lvconvert --force --splitcache writecache_sanity/cworigin Detaching writecache setting cleaner. Sending splitcache pid 5050 a SIGINT Detaching writecache cleaning 736636 blocks This command can be cancelled and rerun to complete writecache detach. lvs attribute:owi-a-C-E- Now deactivate and the force spilt should work (RFE 1915492) lvchange -an writecache_sanity lvconvert --yes --force --splitcache writecache_sanity/cworigin WARNING: Data may be lost by detaching writecache without flushing. lvremove -f writecache_sanity
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (lvm2 bug fix and enhancement update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2021:4431