Remove old patch

OBS-URL: https://build.opensuse.org/package/show/Base:System/mdadm?expand=0&rev=53
This commit is contained in:
Neil Brown 2012-05-09 01:24:09 +00:00 committed by Git OBS Bridge
parent f4371a9780
commit 0cbcffd111

View File

@ -1,125 +0,0 @@
From b451aa4846c5ccca5447a6b6d45e5623b8c8e961 Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.de>
Date: Thu, 6 Oct 2011 13:00:28 +1100
Subject: [PATCH] Fix handling for "auto" line in mdadm.conf
Two problems.
1/ pol_merge was ignoring the pol_auto tag so any 'auto' information
was lost
2/ If a device had not path (e.g. loop devices) or if there were no
path-based policies, we didn't bother looking for policy at all.
So path-independant policies were ignored.
Reported-by: Christian Boltz <suse-beta@cboltz.de>
Signed-off-by: NeilBrown <neilb@suse.de>
---
policy.c | 35 ++++++++++++++++++++++-------------
1 files changed, 22 insertions(+), 13 deletions(-)
diff --git a/policy.c b/policy.c
index 4a6ef82..ef48353 100644
--- a/policy.c
+++ b/policy.c
@@ -195,7 +195,9 @@ static char *disk_path(struct mdinfo *disk)
int prefix_len;
DIR *by_path;
char symlink[PATH_MAX] = "/dev/disk/by-path/";
+ char nm[PATH_MAX];
struct dirent *ent;
+ int rv;
by_path = opendir(symlink);
if (!by_path)
@@ -218,7 +220,17 @@ static char *disk_path(struct mdinfo *disk)
return strdup(ent->d_name);
}
closedir(by_path);
- return NULL;
+ /* A NULL path isn't really acceptable - use the devname.. */
+ sprintf(symlink, "/sys/dev/block/%d:%d", disk->disk.major, disk->disk.minor);
+ rv = readlink(symlink, nm, sizeof(nm));
+ if (rv > 0) {
+ char *dname;
+ nm[rv] = 0;
+ dname = strrchr(nm, '/');
+ if (dname)
+ return strdup(dname + 1);
+ }
+ return strdup("unknown");
}
char type_part[] = "part";
@@ -245,13 +257,13 @@ static int pol_match(struct rule *rule, char *path, char *type)
if (rule->name == rule_path) {
if (pathok == 0)
pathok = -1;
- if (fnmatch(rule->value, path, 0) == 0)
+ if (path && fnmatch(rule->value, path, 0) == 0)
pathok = 1;
}
if (rule->name == rule_type) {
if (typeok == 0)
typeok = -1;
- if (strcmp(rule->value, type) == 0)
+ if (type && strcmp(rule->value, type) == 0)
typeok = 1;
}
rule = rule->next;
@@ -270,7 +282,8 @@ static void pol_merge(struct dev_policy **pol, struct rule *rule)
for (r = rule; r ; r = r->next)
if (r->name == pol_act ||
- r->name == pol_domain)
+ r->name == pol_domain ||
+ r->name == pol_auto)
pol_new(pol, r->name, r->value, metadata);
}
@@ -280,7 +293,10 @@ static int path_has_part(char *path, char **part)
* if it does, place a pointer to "-pathNN"
* in 'part'.
*/
- int l = strlen(path);
+ int l;
+ if (!path)
+ return 0;
+ l = strlen(path);
while (l > 1 && isdigit(path[l-1]))
l--;
if (l < 5 || strncmp(path+l-5, "-part", 5) != 0)
@@ -343,9 +359,6 @@ struct dev_policy *path_policy(char *path, char *type)
struct dev_policy *pol = NULL;
int i;
- if (!type)
- return NULL;
-
rules = config_rules;
while (rules) {
@@ -366,7 +379,7 @@ struct dev_policy *path_policy(char *path, char *type)
/* Now add any metadata-specific internal knowledge
* about this path
*/
- for (i=0; superlist[i]; i++)
+ for (i=0; path && superlist[i]; i++)
if (superlist[i]->get_disk_controller_domain) {
const char *d =
superlist[i]->get_disk_controller_domain(path);
@@ -399,12 +412,8 @@ struct dev_policy *disk_policy(struct mdinfo *disk)
char *type = disk_type(disk);
struct dev_policy *pol = NULL;
- if (!type)
- return NULL;
if (config_rules_has_path)
path = disk_path(disk);
- if (!path)
- return NULL;
pol = path_policy(path, type);
--
1.7.6.4