From: prajnoha@sourceware.org <prajnoha@sourceware.org>
To: lvm-devel@redhat.com
Subject: LVM2/libdm libdm-common.c ioctl/libdm-iface.c
Date: 3 May 2010 21:06:53 -0000 [thread overview]
Message-ID: <20100503210653.28324.qmail@sourceware.org> (raw)
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: prajnoha at sourceware.org 2010-05-03 21:06:53
Modified files:
libdm : libdm-common.c
libdm/ioctl : libdm-iface.c
Log message:
Synchronize "remove" dm task while reverting unsuccessful "create" dm task
(with table provided).
This remove ioctl generates udev events like any other hence it needs to be
synchronized properly as well. Also, add dm task type in debug log when
setting a cookie (for better debugging).
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-common.c.diff?cvsroot=lvm2&r1=1.94&r2=1.95
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/ioctl/libdm-iface.c.diff?cvsroot=lvm2&r1=1.71&r2=1.72
--- LVM2/libdm/libdm-common.c 2010/03/23 14:43:18 1.94
+++ LVM2/libdm/libdm-common.c 2010/05/03 21:06:53 1.95
@@ -1192,7 +1192,7 @@
dmt->cookie_set = 1;
log_debug("Udev cookie 0x%" PRIx32 " (semid %d) assigned to dm_task "
- "with flags 0x%" PRIx16, *cookie, semid, flags);
+ "type %d with flags 0x%" PRIx16, *cookie, semid, dmt->type, flags);
return 1;
--- LVM2/libdm/ioctl/libdm-iface.c 2010/04/28 13:37:37 1.71
+++ LVM2/libdm/ioctl/libdm-iface.c 2010/05/03 21:06:53 1.72
@@ -1546,6 +1546,7 @@
{
struct dm_task *task;
int r;
+ uint32_t cookie;
/* Use new task struct to create the device */
if (!(task = dm_task_create(DM_DEVICE_CREATE))) {
@@ -1625,7 +1626,18 @@
dmt->type = DM_DEVICE_REMOVE;
dm_free(dmt->uuid);
dmt->uuid = NULL;
- dmt->cookie_set = 0;
+
+ /*
+ * Also udev-synchronize "remove" dm task that is a part of this revert!
+ * But only if the original dm task was supposed to be synchronized.
+ */
+ if (dmt->cookie_set) {
+ cookie = (dmt->event_nr & ~DM_UDEV_FLAGS_MASK) |
+ (DM_COOKIE_MAGIC << DM_UDEV_FLAGS_SHIFT);
+ dm_task_set_cookie(dmt, &cookie,
+ (dmt->event_nr & DM_UDEV_FLAGS_MASK) >>
+ DM_UDEV_FLAGS_SHIFT);
+ }
if (!dm_task_run(dmt))
log_error("Failed to revert device creation.");
next reply other threads:[~2010-05-03 21:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-03 21:06 prajnoha [this message]
-- strict thread matches above, loose matches on Subject: below --
2012-01-17 14:36 LVM2/libdm libdm-common.c ioctl/libdm-iface.c prajnoha
2012-03-05 12:40 prajnoha
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=20100503210653.28324.qmail@sourceware.org \
--to=prajnoha@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.