dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

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

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