mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-23 21:35:29 +03:00
5d6bf1efb2
error could be reproduced follow those steps: #!/bin/bash vgcreate vgtest /dev/sdb lvcreate -L 100M -n lv1 vgtest while : do service lvm2-lvmetad restart vgs & pvscan & lvcreate -L 100M -n lv2 vgtest & lvchange /dev/vgtest/lv1 --addtag xxxxx & wait if ! lvs|grep lv2;then echo "err create" break fi sleep 1 lvremove -y /dev/vgtest/lv2 lvchange /dev/vgtest/lv1 --deltag xxxxx done and then fail to create vgtest/lv2, actually lv2 was created, while the metadata written on disk is replaced by lvchange. It could look up lv2 by calling dmsetup table, while lvs could not. This is because, when lvmetad restarted, several lvm commands update token concurrently, when lvcreate recieve "token_mismatch", it cancle communicating with lvmetad, which leads to that lvmetad cache is not sync with the metadata on disk, then lv2 is not committed to lvmetad cache. The metadata of vgtest which lvchange query from lvmetad is out of date. After lvchange, it use the old metadata cover the new one. This patch let lvm process update token synchronously, only one command update lvmetad token at a time. lvmetad_pvscan_single send the metadata on a pv by sending "pv_found" to lvmetad, while the metadata maybe out of date after waiting for the chance to update lvmetad token. Call label_read to read metadata again. Token mismatch may lead to problems, increase log level. Signed-off-by: wangjufeng<wangjufeng@huawei.com> |
||
---|---|---|
.. | ||
lvmcache.c | ||
lvmcache.h | ||
lvmetad.c | ||
lvmetad.h |