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

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