From: Hannes Reinecke <hare@suse.de>
To: Christophe Varoqui <christophe.varoqui@gmail.com>
Cc: dm-devel@redhat.com
Subject: [PATCH 2/6] libmultipath: pass in 'cookie' as argument for dm_addmap()
Date: Wed, 4 May 2016 07:57:26 +0200 [thread overview]
Message-ID: <1462341450-5507-3-git-send-email-hare@suse.de> (raw)
In-Reply-To: <1462341450-5507-1-git-send-email-hare@suse.de>
Instead of generating the cookie internally we should be
passing in the cookie to dm_addmap().
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
libmultipath/devmapper.c | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c
index 48e7d50..ab71fda 100644
--- a/libmultipath/devmapper.c
+++ b/libmultipath/devmapper.c
@@ -274,11 +274,10 @@ dm_device_remove (const char *name, int needsync, int deferred_remove) {
static int
dm_addmap (int task, const char *target, struct multipath *mpp,
- char * params, int ro) {
+ char * params, int ro, uint32_t *cookie) {
int r = 0;
struct dm_task *dmt;
char *prefixed_uuid = NULL;
- uint32_t cookie = 0;
if (!(dmt = dm_task_create (task)))
return 0;
@@ -319,18 +318,18 @@ dm_addmap (int task, const char *target, struct multipath *mpp,
dm_task_no_open_count(dmt);
if (task == DM_DEVICE_CREATE &&
- !dm_task_set_cookie(dmt, &cookie,
+ !dm_task_set_cookie(dmt, cookie,
DM_UDEV_DISABLE_LIBRARY_FALLBACK)) {
- dm_udev_complete(cookie);
+ dm_udev_complete(*cookie);
goto freeout;
}
r = dm_task_run (dmt);
if (task == DM_DEVICE_CREATE) {
if (!r)
- dm_udev_complete(cookie);
+ dm_udev_complete(*cookie);
else
- dm_udev_wait(cookie);
+ dm_udev_wait(*cookie);
}
freeout:
if (prefixed_uuid)
@@ -345,11 +344,13 @@ dm_addmap (int task, const char *target, struct multipath *mpp,
extern int
dm_addmap_create (struct multipath *mpp, char * params) {
int ro;
+ uint32_t cookie = 0;
for (ro = 0; ro <= 1; ro++) {
int err;
- if (dm_addmap(DM_DEVICE_CREATE, TGT_MPATH, mpp, params, ro))
+ if (dm_addmap(DM_DEVICE_CREATE, TGT_MPATH,
+ mpp, params, ro, &cookie))
return 1;
/*
* DM_DEVICE_CREATE is actually DM_DEV_CREATE + DM_TABLE_LOAD.
@@ -374,11 +375,15 @@ dm_addmap_create (struct multipath *mpp, char * params) {
extern int
dm_addmap_reload (struct multipath *mpp, char *params) {
- if (dm_addmap(DM_DEVICE_RELOAD, TGT_MPATH, mpp, params, ADDMAP_RW))
+ uint32_t cookie = 0;
+
+ if (dm_addmap(DM_DEVICE_RELOAD, TGT_MPATH, mpp, params,
+ ADDMAP_RW, &cookie))
return 1;
if (errno != EROFS)
return 0;
- return dm_addmap(DM_DEVICE_RELOAD, TGT_MPATH, mpp, params, ADDMAP_RO);
+ return dm_addmap(DM_DEVICE_RELOAD, TGT_MPATH, mpp, params,
+ ADDMAP_RO, &cookie);
}
extern int
--
2.6.6
next prev parent reply other threads:[~2016-05-04 5:57 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-04 5:57 [PATCH 0/6] multipath cookie handling rework Hannes Reinecke
2016-05-04 5:57 ` [PATCH 1/6] libmultipath: pass in cookie as argument for dm_simplecmd() Hannes Reinecke
2016-05-06 19:06 ` Benjamin Marzinski
2016-05-04 5:57 ` Hannes Reinecke [this message]
2016-05-06 19:27 ` [PATCH 2/6] libmultipath: pass in 'cookie' as argument for dm_addmap() Benjamin Marzinski
2016-05-04 5:57 ` [PATCH 3/6] Remove 'udev_sync' argument from dm_simplecmd() Hannes Reinecke
2016-05-06 19:50 ` Benjamin Marzinski
2016-05-04 5:57 ` [PATCH 4/6] libmultipath: Fixup 'DM_DEVICE_RELOAD' handling Hannes Reinecke
2016-05-06 20:12 ` Benjamin Marzinski
2016-05-09 10:26 ` Hannes Reinecke
2016-05-09 14:56 ` Benjamin Marzinski
2016-05-04 5:57 ` [PATCH 5/6] devmapper: do not flush I/O for DM_DEVICE_CREATE Hannes Reinecke
2016-05-06 20:18 ` Benjamin Marzinski
2016-05-04 5:57 ` [PATCH 6/6] libmultipath: fixup dm_rename to complete cookie on failure Hannes Reinecke
2016-05-06 20:29 ` Benjamin Marzinski
2016-05-06 21:59 ` Alasdair G Kergon
2016-05-06 22:45 ` Benjamin Marzinski
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=1462341450-5507-3-git-send-email-hare@suse.de \
--to=hare@suse.de \
--cc=christophe.varoqui@gmail.com \
--cc=dm-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.