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

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