From: Zdenek Kabelac <zkabelac@redhat.com>
To: LVM general discussion and development <linux-lvm@redhat.com>,
Ming-Hung Tsai <mingnus@gmail.com>
Subject: Re: [linux-lvm] Why LVM doesn't send the dm-thin delete message immediately after volume creation failure
Date: Mon, 4 Dec 2017 11:50:38 +0100 [thread overview]
Message-ID: <79da4c0b-e2cc-01db-1bde-1b662f896edd@redhat.com> (raw)
In-Reply-To: <CAAYit8RUbKP9ntgsDZTjMeSNBLz55Ms3pVY22i9EhfZWncPP7A@mail.gmail.com>
Dne 4.12.2017 v 05:30 Ming-Hung Tsai napsal(a):
> Hi All,
>
> I'm not sure if it is a bug or an intention. If there's error in
> volume creation, the function _lv_create_an_lv() invokes lv_remove()
> to delete the newly created volume. However, in the case of creating
> thin volumes, it just queues a "delete" message without sending it
> immediately. The pending message won't be process until the next
> lvcreate.
>
> Why not send it before the end of _lv_create_an_lv(), to ensure the
> synchronization between LVM and kernel? (i.e., no dangling volume in
> kernel metadata, and the transaction ID is also synced)
>
Hi
This is unfortunately not as easy as it might look like.
This error path is quite hard and lvm2 is not yet fully capable to handle all
variants here.
So ATM it tries to do 'less harm' so possible further recovery is more simple.
The reason here is this - when kernel 'thin-pool' is deleting any thin device
it needs some 'free' metadata space to handle this operation (as it never
overwrite existing btrees and uses journaling).
When thin-pool fails to create new thin device - there is likely big
possibility the reason for failure is 'out-of-metadata' condition.
Clearly there is no point in trying to 'delete' anything if thin-pool hits
this state.
ATM lvm2's 'lvcreate' command is incapable to do 'metadata' resize operation
to gain some more space for successful delete operation - so as such this
is left for separate 'repair'.
As always applies - do not force thin-pool to run at its corner case - since
it's not yet possible to completely automated in all scenarios.
As a protection - lvm2 should not let you even create a new thinLV if the free
space in metadata is above some certain safe-level - but clearly there is race
of time-of-check & time-of-use - so if there is some major load pushed into
thin-pool and at the some time there is try of create - we still may hit
dead-spot (especially for small sized metadata).
So this briefly explain why we rather queue 'delete' instead of directly
pushing it to thin-target.
To enhances this logic - we would need we more 'statuses' during operation for
making sure we are not operating on already overfilled thin-pool - this will
eventually happen...
Regards
Zdenek
prev parent reply other threads:[~2017-12-04 10:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-04 4:30 [linux-lvm] Why LVM doesn't send the dm-thin delete message immediately after volume creation failure Ming-Hung Tsai
2017-12-04 10:50 ` Zdenek Kabelac [this message]
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=79da4c0b-e2cc-01db-1bde-1b662f896edd@redhat.com \
--to=zkabelac@redhat.com \
--cc=linux-lvm@redhat.com \
--cc=mingnus@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).