c025cf
From 6b6112842030309c297a521918d1a2e982426fa3 Mon Sep 17 00:00:00 2001
c025cf
From: NeilBrown <neilb@suse.com>
c025cf
Date: Fri, 9 Nov 2018 17:12:33 +1100
c025cf
Subject: [RHEL7.7 PATCH 02/21] Document PART-POLICY lines
c025cf
c025cf
PART-POLICY has been accepted in mdadm.conf since the same
c025cf
time that POLICY was accepted, but it was never documented.
c025cf
So add the missing documentation.
c025cf
c025cf
Also fix a bug which would have stopped it from working if
c025cf
anyone had ever tried to use it.
c025cf
c025cf
Signed-off-by: NeilBrown <neilb@suse.com>
c025cf
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
c025cf
---
c025cf
 mdadm.conf.5 | 24 +++++++++++++++++++++++-
c025cf
 policy.c     |  2 +-
c025cf
 2 files changed, 24 insertions(+), 2 deletions(-)
c025cf
c025cf
diff --git a/mdadm.conf.5 b/mdadm.conf.5
c025cf
index 18512cb..47c962a 100644
c025cf
--- a/mdadm.conf.5
c025cf
+++ b/mdadm.conf.5
c025cf
@@ -501,7 +501,7 @@ To update hot plug configuration it is necessary to execute
c025cf
 .B mdadm \-\-udev\-rules
c025cf
 command after changing the config file
c025cf
 
c025cf
-Key words used in the
c025cf
+Keywords used in the
c025cf
 .I POLICY
c025cf
 line and supported values are:
c025cf
 
c025cf
@@ -565,6 +565,28 @@ be automatically added to that array (or it's container)
c025cf
 as above and the disk will become a spare in remaining cases
c025cf
 .RE
c025cf
 
c025cf
+.TP
c025cf
+.B PART-POLICY
c025cf
+This is similar to
c025cf
+.B POLICY
c025cf
+and accepts the same keyword assignments.  It allows a consistent set
c025cf
+of policies to applied to each of the partitions of a device.
c025cf
+
c025cf
+A
c025cf
+.B PART-POLICY
c025cf
+line should set
c025cf
+.I type=disk
c025cf
+and identify the path to one or more disk devices.  Each partition on
c025cf
+these disks will be treated according to the
c025cf
+.I action=
c025cf
+setting  from this line.  If a
c025cf
+.I domain
c025cf
+is set in the line, then the domain associated with each patition will
c025cf
+be based on the domain, but with
c025cf
+.RB \(dq -part N\(dq
c025cf
+appended, when N is the partition number for the partition that was
c025cf
+found.
c025cf
+
c025cf
 .SH EXAMPLE
c025cf
 DEVICE /dev/sd[bcdjkl]1
c025cf
 .br
c025cf
diff --git a/policy.c b/policy.c
c025cf
index c0d18a7..258f393 100644
c025cf
--- a/policy.c
c025cf
+++ b/policy.c
c025cf
@@ -300,7 +300,7 @@ static int path_has_part(char *path, char **part)
c025cf
 		l--;
c025cf
 	if (l < 5 || strncmp(path+l-5, "-part", 5) != 0)
c025cf
 		return 0;
c025cf
-	*part = path+l-4;
c025cf
+	*part = path+l-5;
c025cf
 	return 1;
c025cf
 }
c025cf
 
c025cf
-- 
c025cf
2.7.5
c025cf