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

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