All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zdenek Kabelac <zkabelac@redhat.com>
To: lvm-devel@redhat.com
Subject: [QUESTION] lvmcache_label_scan: checksum error at offset xxx
Date: Wed, 9 Jun 2021 13:09:31 +0200	[thread overview]
Message-ID: <ecc2153b-e722-a93a-ec15-06e35196397c@redhat.com> (raw)
In-Reply-To: <1cefcef9-7a6b-4054-68a6-bc0d7556065d@huawei.com>

Dne 09. 06. 21 v 11:32 Wu Guanghao napsal(a):
> Hi,
>
> lvcreate and lvremove execute lvmcache_label_scan() to read the metadata on the lvm device,
> but no lock is added for protection. if other processes are currently executing vg_commit() to submit metadata,
> then it will go wrong.



Hi

The initial scan is going 'lockless' to avoid holding VG locks for too long 
when it's not strictly necessary.

The purpose of this scan is to quickly collect & cache all the info which is 
needed to know. The we take the lock and essentially do another 'rescan' 
however in this case we only need to 'check' if the cache data corresponds to 
the current disk state by checking only PV small header information.

Another 'side' efffect? (probably not very used) is that user may specify VG 
via? VG UUID, but for the VG lock we need to use VG name - so we need to be 
able to 'translate' UUID to vgname - and for this we need to know lvm2 
metadata with this info.

Now when the parallel processe manages to change some data (while holding its 
lock), such internal disk cache will be thrown away (PV header will mismatch) 
and this particular PV is rereaded while the command now holds the correct 
lock. But this is really very occasional situation and the benefit of lockless 
asynchronous scanning outweighs this.


Regards


Zdenek




  reply	other threads:[~2021-06-09 11:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-09  9:32 [QUESTION] lvmcache_label_scan: checksum error at offset xxx Wu Guanghao
2021-06-09 11:09 ` Zdenek Kabelac [this message]
2021-06-10  9:19   ` Wu Guanghao
2021-06-10  9:53     ` Zdenek Kabelac
2021-06-10 18:44     ` David Teigland
2021-06-11  1:53       ` Wu Guanghao
2021-06-11 21:50         ` David Teigland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ecc2153b-e722-a93a-ec15-06e35196397c@redhat.com \
    --to=zkabelac@redhat.com \
    --cc=lvm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.