From: zkabelac@sourceware.org <zkabelac@sourceware.org>
To: lvm-devel@redhat.com
Subject: LVM2/lib/metadata metadata.h thin_manip.c
Date: 19 Oct 2011 16:39:09 -0000 [thread overview]
Message-ID: <20111019163909.17834.qmail@sourceware.org> (raw)
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac at sourceware.org 2011-10-19 16:39:09
Modified files:
lib/metadata : metadata.h thin_manip.c
Log message:
Simple validation of messages in mda
Check we do not combine multiple messages for same LV target
and switch to use 'delete_id' to make it clear for what this device_id
is being used.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.h.diff?cvsroot=lvm2&r1=1.258&r2=1.259
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/thin_manip.c.diff?cvsroot=lvm2&r1=1.10&r2=1.11
--- LVM2/lib/metadata/metadata.h 2011/10/17 14:17:09 1.258
+++ LVM2/lib/metadata/metadata.h 2011/10/19 16:39:09 1.259
@@ -455,7 +455,7 @@
int attach_pool_lv(struct lv_segment *seg, struct logical_volume *pool_lv);
int detach_pool_lv(struct lv_segment *seg);
int attach_pool_message(struct lv_segment *seg, dm_thin_message_t type,
- struct logical_volume *lv, uint32_t device_id,
+ struct logical_volume *lv, uint32_t delete_id,
int read_only);
int detach_pool_messages(struct lv_segment *seg);
--- LVM2/lib/metadata/thin_manip.c 2011/10/19 16:37:30 1.10
+++ LVM2/lib/metadata/thin_manip.c 2011/10/19 16:39:09 1.11
@@ -81,11 +81,36 @@
}
int attach_pool_message(struct lv_segment *seg, dm_thin_message_t type,
- struct logical_volume *lv, uint32_t device_id,
+ struct logical_volume *lv, uint32_t delete_id,
int read_only)
{
struct lv_thin_message *tmsg;
+ dm_list_iterate_items(tmsg, &seg->thin_messages) {
+ if (tmsg->type == type) {
+ switch (tmsg->type) {
+ case DM_THIN_MESSAGE_CREATE_SNAP:
+ case DM_THIN_MESSAGE_CREATE_THIN:
+ case DM_THIN_MESSAGE_TRIM:
+ if (tmsg->u.lv == lv) {
+ log_error("Message referring LV %s already queued for %s.",
+ tmsg->u.lv->name, seg->lv->name);
+ return 0;
+ }
+ break;
+ case DM_THIN_MESSAGE_DELETE:
+ if (tmsg->u.delete_id == delete_id) {
+ log_error("Delete of device %u already queued for %s.",
+ tmsg->u.delete_id, seg->lv->name);
+ return 0;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
if (!(tmsg = dm_pool_alloc(seg->lv->vg->vgmem, sizeof(*tmsg)))) {
log_error("Failed to allocate memory for message.");
return 0;
@@ -98,7 +123,7 @@
tmsg->u.lv = lv;
break;
case DM_THIN_MESSAGE_DELETE:
- tmsg->u.delete_id = device_id;
+ tmsg->u.delete_id = delete_id;
break;
default:
log_error(INTERNAL_ERROR "Unsupported message type %d", type);
next reply other threads:[~2011-10-19 16:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-19 16:39 zkabelac [this message]
-- strict thread matches above, loose matches on Subject: below --
2012-01-25 8:55 LVM2/lib/metadata metadata.h thin_manip.c zkabelac
2011-10-22 16:44 zkabelac
2011-10-03 18:39 zkabelac
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=20111019163909.17834.qmail@sourceware.org \
--to=zkabelac@sourceware.org \
--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.