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

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