0002-Document-PART-POLICY-lines.patch 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. From 6b6112842030309c297a521918d1a2e982426fa3 Mon Sep 17 00:00:00 2001
  2. From: NeilBrown <neilb@suse.com>
  3. Date: Fri, 9 Nov 2018 17:12:33 +1100
  4. Subject: [PATCH 02/11] Document PART-POLICY lines
  5. PART-POLICY has been accepted in mdadm.conf since the same
  6. time that POLICY was accepted, but it was never documented.
  7. So add the missing documentation.
  8. Also fix a bug which would have stopped it from working if
  9. anyone had ever tried to use it.
  10. Signed-off-by: NeilBrown <neilb@suse.com>
  11. Signed-off-by: Jes Sorensen <jsorensen@fb.com>
  12. ---
  13. mdadm.conf.5 | 24 +++++++++++++++++++++++-
  14. policy.c | 2 +-
  15. 2 files changed, 24 insertions(+), 2 deletions(-)
  16. diff --git a/mdadm.conf.5 b/mdadm.conf.5
  17. index 18512cb0..47c962ab 100644
  18. --- a/mdadm.conf.5
  19. +++ b/mdadm.conf.5
  20. @@ -501,7 +501,7 @@ To update hot plug configuration it is necessary to execute
  21. .B mdadm \-\-udev\-rules
  22. command after changing the config file
  23. -Key words used in the
  24. +Keywords used in the
  25. .I POLICY
  26. line and supported values are:
  27. @@ -565,6 +565,28 @@ be automatically added to that array (or it's container)
  28. as above and the disk will become a spare in remaining cases
  29. .RE
  30. +.TP
  31. +.B PART-POLICY
  32. +This is similar to
  33. +.B POLICY
  34. +and accepts the same keyword assignments. It allows a consistent set
  35. +of policies to applied to each of the partitions of a device.
  36. +
  37. +A
  38. +.B PART-POLICY
  39. +line should set
  40. +.I type=disk
  41. +and identify the path to one or more disk devices. Each partition on
  42. +these disks will be treated according to the
  43. +.I action=
  44. +setting from this line. If a
  45. +.I domain
  46. +is set in the line, then the domain associated with each patition will
  47. +be based on the domain, but with
  48. +.RB \(dq -part N\(dq
  49. +appended, when N is the partition number for the partition that was
  50. +found.
  51. +
  52. .SH EXAMPLE
  53. DEVICE /dev/sd[bcdjkl]1
  54. .br
  55. diff --git a/policy.c b/policy.c
  56. index c0d18a7e..258f3931 100644
  57. --- a/policy.c
  58. +++ b/policy.c
  59. @@ -300,7 +300,7 @@ static int path_has_part(char *path, char **part)
  60. l--;
  61. if (l < 5 || strncmp(path+l-5, "-part", 5) != 0)
  62. return 0;
  63. - *part = path+l-4;
  64. + *part = path+l-5;
  65. return 1;
  66. }
  67. --
  68. 2.19.1