From: Zdenek Kabelac <zkabelac@redhat.com>
To: lvm-devel@redhat.com
Subject: [PATCH 1/3] Fix mem
Date: Sat, 26 Mar 2011 14:04:43 +0100 [thread overview]
Message-ID: <4D8DE46B.2060705@redhat.com> (raw)
In-Reply-To: <4D8DB905.7020100@redhat.com>
Dne 26.3.2011 10:59, Milan Broz napsal(a):
> On 03/25/2011 10:57 PM, Zdenek Kabelac wrote:
>
>> - unlock_and_free_vg(cmd, vg_from, vg_name_from);
>> - unlock_and_free_vg(cmd, vg_to, vg_name_to);
>> + unlock_vg(cmd, vg_name_from);
>> + unlock_vg(cmd, vg_name_to);
>> + free_vg(vg_to);
>> + free_vg(vg_from);
>
> I guess there is still request to do proper deep copy...
>
> Anyway, this is so simple and obvious for now -> ACK
In fact there is even simpler version - to always unconditionally unlock and
free VGs in this order:
--
unlock_and_free_vg(cmd, vg_to, vg_name_to);
unlock_and_free_vg(cmd, vg_from, vg_name_from);
--
This simplifies and shortens the code a bit ;). 'vg_to' is always released
before 'vg_from' - if we make this a documented rule in the source code - we
currently avoid the need of deep copy (It would quite complicate our code, to
add such 'deep' copy code to every target - as we are not in C++ - it's quite
ugly task to do). As long as we only move object pointers from 'vg_from' to
'vg_to' it's safe - and we may even avoid partial 'deep' copy of some object
there - if we can count with the right free_vg() order.
(Also implementing of deep-copy only for very occasionally used vgmerge and
vgsplit currently sound like a bit to complex).
AFAIK - for deadlock-less locking - only the locking order is important,
unlocking could happen in any order as long as all locks are always released
before the next usage - so current unlock ordering is not needed.
Zdenek
next prev parent reply other threads:[~2011-03-26 13:04 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-25 21:57 [PATCH 0/3] Memory fixes Zdenek Kabelac
2011-03-25 21:57 ` [PATCH 1/3] Fix mem Zdenek Kabelac
2011-03-26 9:59 ` Milan Broz
2011-03-26 13:04 ` Zdenek Kabelac [this message]
2011-03-25 21:57 ` [PATCH 2/3] Set our own in/out buffers Zdenek Kabelac
2011-03-26 10:09 ` Milan Broz
2011-03-26 12:53 ` Zdenek Kabelac
2011-04-04 12:09 ` Zdenek Kabelac
2011-03-25 21:57 ` [PATCH 3/3] Valgrind updates Zdenek Kabelac
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=4D8DE46B.2060705@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.