Blame SOURCES/0041-RH-check-for-erofs.patch

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