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

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