You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

122 lines
3.8 KiB

---
libmultipath/configure.c | 7 ------
libmultipath/devmapper.c | 53 ++++++++++++++++++++++-------------------------
libmultipath/devmapper.h | 2 -
3 files changed, 25 insertions(+), 37 deletions(-)
Index: multipath-tools-130222/libmultipath/configure.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/configure.c
+++ multipath-tools-130222/libmultipath/configure.c
@@ -384,24 +384,17 @@ domap (struct multipath * mpp, char * pa
r = dm_addmap_create(mpp, params);
- if (!r)
- r = dm_addmap_create_ro(mpp, params);
-
lock_multipath(mpp, 0);
break;
case ACT_RELOAD:
r = dm_addmap_reload(mpp, params);
- if (!r)
- r = dm_addmap_reload_ro(mpp, params);
if (r)
r = dm_simplecmd_noflush(DM_DEVICE_RESUME, mpp->alias);
break;
case ACT_RESIZE:
r = dm_addmap_reload(mpp, params);
- if (!r)
- r = dm_addmap_reload_ro(mpp, params);
if (r)
r = dm_simplecmd_flush(DM_DEVICE_RESUME, mpp->alias, 1);
break;
Index: multipath-tools-130222/libmultipath/devmapper.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/devmapper.c
+++ multipath-tools-130222/libmultipath/devmapper.c
@@ -298,42 +298,39 @@ dm_addmap (int task, const char *target,
return r;
}
-static int
-_dm_addmap_create (struct multipath *mpp, char * params, int ro) {
- int r;
- r = dm_addmap(DM_DEVICE_CREATE, TGT_MPATH, mpp, params, 1, ro);
- /*
- * DM_DEVICE_CREATE is actually DM_DEV_CREATE + DM_TABLE_LOAD.
- * Failing the second part leaves an empty map. Clean it up.
- */
- if (!r && dm_map_present(mpp->alias)) {
- condlog(3, "%s: failed to load map (a path might be in use)",
- mpp->alias);
- dm_flush_map_nosync(mpp->alias);
+extern int
+dm_addmap_create (struct multipath *mpp, char * params) {
+ int ro;
+
+ for (ro = 0; ro <= 1; ro++) {
+ int err;
+
+ if (dm_addmap(DM_DEVICE_CREATE, TGT_MPATH, mpp, params, 1, ro))
+ return 1;
+ /*
+ * DM_DEVICE_CREATE is actually DM_DEV_CREATE + DM_TABLE_LOAD.
+ * Failing the second part leaves an empty map. Clean it up.
+ */
+ err = errno;
+ if (dm_map_present(mpp->alias)) {
+ condlog(3, "%s: failed to load map (a path might be in use)", mpp->alias);
+ dm_flush_map_nosync(mpp->alias);
+ }
+ if (err != EROFS)
+ break;
}
- return r;
+ return 0;
}
#define ADDMAP_RW 0
#define ADDMAP_RO 1
extern int
-dm_addmap_create (struct multipath *mpp, char *params) {
- return _dm_addmap_create(mpp, params, ADDMAP_RW);
-}
-
-extern int
-dm_addmap_create_ro (struct multipath *mpp, char *params) {
- return _dm_addmap_create(mpp, params, ADDMAP_RO);
-}
-
-extern int
dm_addmap_reload (struct multipath *mpp, char *params) {
- return dm_addmap(DM_DEVICE_RELOAD, TGT_MPATH, mpp, params, 0, ADDMAP_RW);
-}
-
-extern int
-dm_addmap_reload_ro (struct multipath *mpp, char *params) {
+ if (dm_addmap(DM_DEVICE_RELOAD, TGT_MPATH, mpp, params, 0, ADDMAP_RW))
+ return 1;
+ if (errno != EROFS)
+ return 0;
return dm_addmap(DM_DEVICE_RELOAD, TGT_MPATH, mpp, params, 0, ADDMAP_RO);
}
Index: multipath-tools-130222/libmultipath/devmapper.h
===================================================================
--- multipath-tools-130222.orig/libmultipath/devmapper.h
+++ multipath-tools-130222/libmultipath/devmapper.h
@@ -12,9 +12,7 @@ int dm_drv_version (unsigned int * versi
int dm_simplecmd_flush (int, const char *, int);
int dm_simplecmd_noflush (int, const char *);
int dm_addmap_create (struct multipath *mpp, char *params);
-int dm_addmap_create_ro (struct multipath *mpp, char *params);
int dm_addmap_reload (struct multipath *mpp, char *params);
-int dm_addmap_reload_ro (struct multipath *mpp, char *params);
int dm_map_present (const char *);
int dm_get_map(char *, unsigned long long *, char *);
int dm_get_status(char *, char *);