1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00
lvm2/tools
David Teigland 6ab2a22fcf lvremove: fix failed remove of all LVs in shared VG
commit a125a3bb50 "lv_remove: reduce commits for removed LVs"
changed "lvremove <vgname>" from removing one LV at a time,
to removing all LVs in one vg write/commit.  It also changed
the behavior if some of the LVs could not be removed, from
removing those LVs that could be removed, to removing nothing
if any LV could not be removed.  This caused a regression in
shared VGs using sanlock, in which the on-disk lease was
removed for any LV that could be removed, even if the command
decided to remove nothing.  This would leave LVs without a
valid ondisk lease, and "lock failed: error -221" would be
returned for any command attempting to lock the LV.

Fix this by not freeing the on-disk leases until after the
command has decided to go ahead and remove everything, and
has written the VG metadata.

Before the fix:

node1: lvchange -ay vg/lv1
node2: lvchange -ay vg/lv2

node1: lvs
  lv1  test -wi-a----- 4.00m
  lv2  test -wi------- 4.00m
node2: lvs
  lv1  test -wi------- 4.00m
  lv2  test -wi-a----- 4.00m

node1: lvremove -y vg/lv1 vg/lv2
  LV locked by other host: vg/lv2

(lvremove removed neither of the LVs, but it freed
the lock for lv1, which could have been removed
except for the proper locking failure on lv2.)

node1: lvs
  lv1  test -wi------- 4.00m
  lv2  test -wi------- 4.00m

node1: lvremove -y vg/lv1
LV vg/lv1 lock failed: error -221

(The lock for lv1 is gone, so nothing can be done with it.)
2024-10-16 13:18:14 -05:00
..
.exported_symbols generate liblvm2cmd exported symbols too 2010-06-25 18:23:10 +00:00
.gitignore tools: add generated headers to .gitignore 2017-03-10 13:13:41 +00:00
args.h args: readonly description update 2024-09-06 08:44:06 -05:00
cmdnames.h doc: change fsf address 2016-01-21 12:11:37 +01:00
command_enums.h cleanup: use ALTERNATIVE_EXTENTS 2024-05-27 15:16:25 +02:00
command-lines.in cleanup: typos man pages 2024-08-30 16:51:15 +02:00
command.c cleanup: typos in logging 2024-08-30 16:51:15 +02:00
command.h cleanup: typos in comments 2024-08-30 16:51:15 +02:00
commands.h cleanup: use ALTERNATIVE_EXTENTS 2024-05-27 15:16:25 +02:00
dumpconfig.c lvmconfig: add --valuesonly option 2022-08-17 10:47:24 +02:00
errors.h tools: Introduce exit code EINIT_FAILED. 2017-07-26 23:18:03 +01:00
formats.c doc: change fsf address 2016-01-21 12:11:37 +01:00
license.inc makefiles: avoid piping 2023-02-10 17:50:27 +01:00
lv_props.h lv_prop: simplier macro usage 2024-05-13 02:20:29 +02:00
lv_types.h lv_types: sort order of types 2024-05-13 12:58:37 +02:00
lvchange.c cleanup: typos in comments 2024-08-30 16:51:15 +02:00
lvconvert_poll.c cleanup: typos in comments 2024-08-30 16:51:15 +02:00
lvconvert_poll.h build: Don't generate symlinks in include/ dir 2018-05-14 10:30:20 +01:00
lvconvert.c cleanup: typos in comments 2024-08-30 16:51:15 +02:00
lvcreate.c cleanup: typos in comments 2024-08-30 16:51:15 +02:00
lvdisplay.c process_each_lv: add check_single_lv function 2017-02-13 08:20:10 -06:00
lvextend.c lvresize: restructure code 2022-09-09 16:18:55 -05:00
lvm2cmd-static.c lvmcmdlib: lvm2_init_threaded 2020-10-20 22:22:52 +02:00
lvm2cmd.c lvmcmdlib: lvm2_init_threaded 2020-10-20 22:22:52 +02:00
lvm2cmd.h lvmcmdlib: lvm2_init_threaded 2020-10-20 22:22:52 +02:00
lvm2cmdline.h lvmcmdline: use strcut as const 2024-05-13 02:15:55 +02:00
lvm-static.c doc: change fsf address 2016-01-21 12:11:37 +01:00
lvm.c cleanup: typos in comments 2024-08-30 16:51:15 +02:00
lvmcmdlib.c cmdlib_lvm2_init: release cmd on failure path 2021-09-13 12:34:41 +02:00
lvmcmdline.c cleanup: typos in comments 2024-08-30 16:51:15 +02:00
lvmdevices.c cleanup: typos in comments 2024-08-30 16:51:15 +02:00
lvmdiskscan.c Revert "dev-cache: move global variables into cmd struct" 2024-07-08 15:32:41 -05:00
lvpoll.c const: _fns poll_function 2024-05-04 01:01:57 +02:00
lvreduce.c lvresize: restructure code 2022-09-09 16:18:55 -05:00
lvremove.c lvremove: initilize struct list 2024-05-27 18:23:26 +02:00
lvrename.c toollib: make it possible to also process internal VGs, add 'include_internal' switch to process_each_vg fn 2016-06-20 11:33:42 +02:00
lvresize.c cleanup: typos in comments 2024-08-30 16:51:15 +02:00
lvscan.c debug: print WARNING: 2023-07-15 11:05:35 +02:00
Makefile.in command: split man-generator code 2024-04-29 00:13:43 +02:00
man-generator.c cleanup: typos in comments 2024-08-30 16:51:15 +02:00
polldaemon.c cleanup: typos in comments 2024-08-30 16:51:15 +02:00
pvchange.c device_id: ensure pvid buffers are ID_LEN+1 2023-11-09 13:15:02 -06:00
pvck.c Revert "dev-cache: move global variables into cmd struct" 2024-07-08 15:32:41 -05:00
pvcreate.c cleanup: typos in comments 2024-08-30 16:51:15 +02:00
pvdisplay.c add device hints to reduce scanning 2019-01-15 10:23:47 -06:00
pvmove_poll.c cov: ensure NULL baton is not dereferenced 2023-05-06 19:22:05 +02:00
pvmove_poll.h doc: change fsf address 2016-01-21 12:11:37 +01:00
pvmove.c cleanup: typos in comments 2024-08-30 16:51:15 +02:00
pvremove.c exit with error when --devicesfile name doesn't exist 2022-07-06 10:10:58 -05:00
pvresize.c exported vg handling 2019-06-25 15:39:08 -05:00
pvscan.c cleanup: typos in comments 2024-08-30 16:51:15 +02:00
reporter.c cleanup: typos in comments 2024-08-30 16:51:15 +02:00
segtypes.c doc: change fsf address 2016-01-21 12:11:37 +01:00
stub.h Remove vgconvert 2018-06-13 14:14:03 -05:00
tags.c doc: change fsf address 2016-01-21 12:11:37 +01:00
tool.h configure: avoid repeative inclusion of configure.h 2018-12-21 19:19:50 +01:00
toollib.c lvremove: fix failed remove of all LVs in shared VG 2024-10-16 13:18:14 -05:00
toollib.h integrity: add --integritysettings for tuning 2024-08-07 17:40:34 -05:00
tools.h cleanup: typos in comments 2024-08-30 16:51:15 +02:00
vals.h cleanup: typos in comments 2024-08-30 16:51:15 +02:00
vgcfgbackup.c cov: annotate to silent some coverity warning 2024-05-08 01:55:21 +02:00
vgcfgrestore.c refactor: update dm_strncpy to _dm_strncpy 2024-04-04 19:38:21 +02:00
vgchange.c cleanup: typos in comments 2024-08-30 16:51:15 +02:00
vgck.c cleanup: typos in comments 2024-08-30 16:51:15 +02:00
vgcreate.c lvmlockd: parse lockopt string into flags 2024-06-27 13:29:03 -05:00
vgdisplay.c tidy: Add missing underscores to statics. 2017-10-18 15:58:13 +01:00
vgexport.c backup: automatically store data on vg_unlock 2021-06-09 14:56:13 +02:00
vgextend.c exit with error when --devicesfile name doesn't exist 2022-07-06 10:10:58 -05:00
vgimport.c vgimport: invalidate hints 2023-02-22 16:19:48 -06:00
vgimportclone.c Revert "dev-cache: move global variables into cmd struct" 2024-07-08 15:32:41 -05:00
vgimportdevices.c cleanup: typos in comments 2024-08-30 16:51:15 +02:00
vgmerge.c exit with error when --devicesfile name doesn't exist 2022-07-06 10:10:58 -05:00
vgmknodes.c tools: vgmknodes: use display_lvname 2024-08-14 14:20:55 +02:00
vgreduce.c backup: automatically store data on vg_unlock 2021-06-09 14:56:13 +02:00
vgremove.c cleanup: typos in comments 2024-08-30 16:51:15 +02:00
vgrename.c cov: clean up pvid and vgid usage 2021-08-16 11:31:15 -05:00
vgscan.c debug: print WARNING: 2023-07-15 11:05:35 +02:00
vgsplit.c cleanup: typos in comments 2024-08-30 16:51:15 +02:00