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

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