summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--ReadMe.c1
-rw-r--r--config.c8
-rw-r--r--mdadm.822
-rw-r--r--mdadm.c20
-rw-r--r--mdadm.conf.514
-rw-r--r--mdadm.h2
-rw-r--r--mdopen.c10
8 files changed, 75 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index c1e1b7da..154c2b42 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Changes Priot to this release
+ - When creating devices in /dev/md/ create matching symlinks
+ from /dev. e.g. /dev/md0 -> /dev/md/0.
+ Allow this to be disabled in mdadm.conf or on command line.
+
Changes Prior to 2.5.3 release
- Document v0.91 superblocks in md.4
- Make GPL explicit in man pages.
diff --git a/ReadMe.c b/ReadMe.c
index c9e64cd5..f1b3ee3e 100644
--- a/ReadMe.c
+++ b/ReadMe.c
@@ -139,6 +139,7 @@ struct option long_options[] = {
{"re-add", 0, 0, ReAdd},
{"homehost", 1, 0, HomeHost},
{"auto-update-homehost", 0, 0, AutoHomeHost},
+ {"symlinks", 1, 0, Symlinks},
/* For assemble */
{"uuid", 1, 0, 'u'},
diff --git a/config.c b/config.c
index b43e79c7..219308dc 100644
--- a/config.c
+++ b/config.c
@@ -255,6 +255,7 @@ mddev_dev_t load_partitions(void)
}
struct createinfo createinfo = {
+ .symlinks = 1,
#ifdef DEBIAN
.gid = 6, /* disk */
.mode = 0660,
@@ -364,8 +365,11 @@ static void createline(char *line)
if (!createinfo.supertype)
fprintf(stderr, Name ": metadata format %s unknown, ignoring\n",
w+9);
-
- } else {
+ } else if (strncasecmp(w, "symlinks=yes", 12) == 0)
+ createinfo.symlinks = 1;
+ else if (strncasecmp(w, "symlinks=no", 11) == 0)
+ createinfo.symlinks = 0;
+ else {
fprintf(stderr, Name ": unrecognised word on CREATE line: %s\n",
w);
}
diff --git a/mdadm.8 b/mdadm.8
index 1508c586..3ebef842 100644
--- a/mdadm.8
+++ b/mdadm.8
@@ -594,6 +594,28 @@ number will be considered unused if there is no active array for that
number, and there is no entry in /dev for that number and with a
non-standard name.
+.TP
+.BR --symlink = no
+Normally when
+.B --auto
+causes
+.I mdadm
+to create devices in
+.B /dev/md/
+it will also create symlinks from
+.B /dev/
+with names starting with
+.B md
+or
+.BR md_ .
+Use
+.B --symlink=no
+to suppress this, or
+.B --symlink=yes
+to enforce this even if it is suppressing
+.IR mdadm.conf .
+
+
.SH For assemble:
.TP
diff --git a/mdadm.c b/mdadm.c
index 9fe56abe..bc8aac87 100644
--- a/mdadm.c
+++ b/mdadm.c
@@ -75,6 +75,7 @@ int main(int argc, char *argv[])
int force = 0;
int test = 0;
int assume_clean = 0;
+ char *symlinks = NULL;
/* autof indicates whether and how to create device node.
* bottom 3 bits are style. Rest (when shifted) are number of parts
* 0 - unset
@@ -499,6 +500,12 @@ int main(int argc, char *argv[])
autof = parse_auto(optarg, "--auto flag", 0);
continue;
+ case O(CREATE,Symlinks):
+ case O(BUILD,Symlinks):
+ case O(ASSEMBLE,Symlinks): /* auto creation of symlinks in /dev to /dev/md */
+ symlinks = optarg;
+ continue;
+
case O(BUILD,'f'): /* force honouring '-n 1' */
case O(GROW,'f'): /* ditto */
case O(CREATE,'f'): /* force honouring of device list */
@@ -858,6 +865,19 @@ int main(int argc, char *argv[])
fputs(Usage, stderr);
exit(2);
}
+
+ if (symlinks) {
+ struct createinfo *ci = conf_get_create_info();
+
+ if (strcasecmp(symlinks, "yes") == 0)
+ ci->symlinks = 1;
+ else if (strcasecmp(symlinks, "no") == 0)
+ ci->symlinks = 0;
+ else {
+ fprintf(stderr, Name ": option --symlinks must be 'no' or 'yes'\n");
+ exit(2);
+ }
+ }
/* Ok, got the option parsing out of the way
* hopefully it's mostly right but there might be some stuff
* missing
diff --git a/mdadm.conf.5 b/mdadm.conf.5
index 7df36d9e..f2cb35f4 100644
--- a/mdadm.conf.5
+++ b/mdadm.conf.5
@@ -273,6 +273,20 @@ missing device entries should be created.
The name of the metadata format to use if none is explicitly given.
This can be useful to impose a system-wide default of version-1 superblocks.
+.TP
+.B symlinks=no
+Normally when creating devices in
+.B /dev/md/
+.I mdadm
+will create a matching symlink from
+.B /dev/
+with a name starting
+.B md
+or
+.BR md_ .
+Give
+.B symlinked=no
+to suppress this symlink creation.
.RE
diff --git a/mdadm.h b/mdadm.h
index 420e6a34..29fc7c88 100644
--- a/mdadm.h
+++ b/mdadm.h
@@ -132,6 +132,7 @@ struct createinfo {
int gid;
int autof;
int mode;
+ int symlinks;
struct supertype *supertype;
};
@@ -167,6 +168,7 @@ enum special_options {
BackupFile,
HomeHost,
AutoHomeHost,
+ Symlinks,
};
/* structures read from config file */
diff --git a/mdopen.c b/mdopen.c
index 488956cf..0c049a03 100644
--- a/mdopen.c
+++ b/mdopen.c
@@ -48,7 +48,7 @@ void make_dev_symlink(char *dev)
}
-void make_parts(char *dev, int cnt)
+void make_parts(char *dev, int cnt, int symlinks)
{
/* make 'cnt' partition devices for 'dev'
* We use the major/minor from dev and add 1..cnt
@@ -88,7 +88,7 @@ void make_parts(char *dev, int cnt)
perror("chown");
if (chmod(name, stb2.st_mode & 07777))
perror("chmod");
- if (strncmp(name, "/dev/md/", 8) == 0)
+ if (symlinks && strncmp(name, "/dev/md/", 8) == 0)
make_dev_symlink(name);
stat(name, &stb2);
add_dev(name, &stb2, 0, NULL);
@@ -192,7 +192,7 @@ int open_mddev(char *dev, int autof)
return -1;
} else {
if (major != MD_MAJOR && parts > 0)
- make_parts(dev, parts);
+ make_parts(dev, parts, ci->symlinks);
return mdfd;
}
}
@@ -279,10 +279,10 @@ int open_mddev(char *dev, int autof)
}
stat(dev, &stb);
add_dev(dev, &stb, 0, NULL);
- if (strncmp(dev, "/dev/md/", 8) == 0)
+ if (ci->symlinks && strncmp(dev, "/dev/md/", 8) == 0)
make_dev_symlink(dev);
if (major != MD_MAJOR)
- make_parts(dev,parts);
+ make_parts(dev,parts, ci->symlinks);
}
}
mdfd = open(dev, O_RDWR, 0);