Blame SOURCES/0212-RHBZ-1431562-for-read-only.patch

d88bf6
---
d88bf6
 libmultipath/devmapper.c |   10 ++++++----
d88bf6
 libmultipath/structs.h   |    1 +
d88bf6
 multipathd/main.c        |    5 +++--
d88bf6
 3 files changed, 10 insertions(+), 6 deletions(-)
d88bf6
d88bf6
Index: multipath-tools-130222/libmultipath/devmapper.c
d88bf6
===================================================================
d88bf6
--- multipath-tools-130222.orig/libmultipath/devmapper.c
d88bf6
+++ multipath-tools-130222/libmultipath/devmapper.c
d88bf6
@@ -358,10 +358,12 @@ dm_addmap_create (struct multipath *mpp,
d88bf6
 extern int
d88bf6
 dm_addmap_reload (struct multipath *mpp, char *params) {
d88bf6
 	sysfs_set_max_sectors_kb(mpp, 1);
d88bf6
-	if (dm_addmap(DM_DEVICE_RELOAD, TGT_MPATH, mpp, params, 0, ADDMAP_RW, SKIP_KPARTX_OFF))
d88bf6
-		return 1;
d88bf6
-	if (errno != EROFS)
d88bf6
-		return 0;
d88bf6
+	if (!mpp->force_readonly) {
d88bf6
+		if (dm_addmap(DM_DEVICE_RELOAD, TGT_MPATH, mpp, params, 0, ADDMAP_RW, SKIP_KPARTX_OFF))
d88bf6
+			return 1;
d88bf6
+		if (errno != EROFS)
d88bf6
+			return 0;
d88bf6
+	}
d88bf6
 	return dm_addmap(DM_DEVICE_RELOAD, TGT_MPATH, mpp, params, 0, ADDMAP_RO, SKIP_KPARTX_OFF);
d88bf6
 }
d88bf6
 
d88bf6
Index: multipath-tools-130222/libmultipath/structs.h
d88bf6
===================================================================
d88bf6
--- multipath-tools-130222.orig/libmultipath/structs.h
d88bf6
+++ multipath-tools-130222/libmultipath/structs.h
d88bf6
@@ -259,6 +259,7 @@ struct multipath {
d88bf6
 	int force_udev_reload;
d88bf6
 	int skip_kpartx;
d88bf6
 	int max_sectors_kb;
d88bf6
+	int force_readonly;
d88bf6
 	unsigned int dev_loss;
d88bf6
 	uid_t uid;
d88bf6
 	gid_t gid;
d88bf6
Index: multipath-tools-130222/multipathd/main.c
d88bf6
===================================================================
d88bf6
--- multipath-tools-130222.orig/multipathd/main.c
d88bf6
+++ multipath-tools-130222/multipathd/main.c
d88bf6
@@ -831,9 +831,10 @@ uev_update_path (struct uevent *uev, str
d88bf6
 				pp->mpp->wait_for_udev = 2;
d88bf6
 				return 0;
d88bf6
 			}
d88bf6
-
d88bf6
+			if (ro == 1)
d88bf6
+				pp->mpp->force_readonly = 1;
d88bf6
 			retval = reload_map(vecs, pp->mpp, 0);
d88bf6
-
d88bf6
+			pp->mpp->force_readonly = 0;
d88bf6
 			condlog(2, "%s: map %s reloaded (retval %d)",
d88bf6
 				uev->kernel, pp->mpp->alias, retval);
d88bf6
 		}