dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

Blame SOURCES/dont-allow-to-enable-PPL-reshape-in-progress.patch

dd3a91
commit 922a58292fafa4efcfcd44fbc46b0665681c955a
dd3a91
Author: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
dd3a91
Date:   Fri Jun 9 16:20:19 2017 +0200
dd3a91
dd3a91
    Grow: don't allow to enable PPL when reshape is in progress
dd3a91
    
dd3a91
    Don't allow to enable PPL consistency policy when reshape is in progress.
dd3a91
    Current PPL implementation doesn't work when reshape is taking place.
dd3a91
    
dd3a91
    Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
dd3a91
    Signed-off-by: Jes Sorensen <jsorensen@fb.com>
dd3a91
dd3a91
diff --git a/Grow.c b/Grow.c
dd3a91
index f7325cb..b1cb306 100644
dd3a91
--- a/Grow.c
dd3a91
+++ b/Grow.c
dd3a91
@@ -530,6 +530,7 @@ int Grow_consistency_policy(char *devname, int fd, struct context *c, struct sha
dd3a91
 	char *subarray = NULL;
dd3a91
 	int ret = 0;
dd3a91
 	char container_dev[PATH_MAX];
dd3a91
+	char buf[20];
dd3a91
 
dd3a91
 	if (s->consistency_policy != CONSISTENCY_POLICY_RESYNC &&
dd3a91
 	    s->consistency_policy != CONSISTENCY_POLICY_PPL) {
dd3a91
@@ -577,6 +578,17 @@ int Grow_consistency_policy(char *devname, int fd, struct context *c, struct sha
dd3a91
 		goto free_info;
dd3a91
 	}
dd3a91
 
dd3a91
+	if (s->consistency_policy == CONSISTENCY_POLICY_PPL) {
dd3a91
+		if (sysfs_get_str(sra, NULL, "sync_action", buf, 20) <= 0) {
dd3a91
+			ret = 1;
dd3a91
+			goto free_info;
dd3a91
+		} else if (strcmp(buf, "reshape\n") == 0) {
dd3a91
+			pr_err("PPL cannot be enabled when reshape is in progress\n");
dd3a91
+			ret = 1;
dd3a91
+			goto free_info;
dd3a91
+		}
dd3a91
+	}
dd3a91
+
dd3a91
 	if (subarray) {
dd3a91
 		char *update;
dd3a91