diff options
author | NeilBrown <neilb@suse.de> | 2011-09-08 13:05:31 +1000 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2011-09-08 13:05:31 +1000 |
commit | 11b391ece9fa284a151362537af093aa44883696 (patch) | |
tree | 65b950fd0f692d9aa90e12568e4d4b00088c1613 /Manage.c | |
parent | 01619b481883926f13da2b1b88f3125359a6a08b (diff) | |
download | mdadm-11b391ece9fa284a151362537af093aa44883696.tar.gz |
Discourage large devices from being added to 0.90 arrays.
0.90 arrays can only use up to 4TB per device. So when a larger
device is added, complain a bit. Still allow it if --force is given
as there could be a valid use.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'Manage.c')
-rw-r--r-- | Manage.c | 29 |
1 files changed, 25 insertions, 4 deletions
@@ -371,7 +371,7 @@ int Manage_resize(char *devname, int fd, long long size, int raid_disks) int Manage_subdevs(char *devname, int fd, struct mddev_dev *devlist, int verbose, int test, - char *update) + char *update, int force) { /* do something to each dev. * devmode can be @@ -632,6 +632,27 @@ int Manage_subdevs(char *devname, int fd, continue; } + if (tst->ss->validate_geometry( + tst, array.level, array.layout, + array.raid_disks, NULL, + ldsize >> 9, NULL, NULL, 0) == 0) { + if (!force) { + fprintf(stderr, Name + ": %s is larger than %s can " + "effectively use.\n" + " Add --force is you " + "really wan to add this device.\n", + add_dev, devname); + close(tfd); + return 1; + } + fprintf(stderr, Name + ": %s is larger than %s can " + "effectively use.\n" + " Adding anyway as --force " + "was given.\n", + add_dev, devname); + } if (!tst->ss->external && array.major_version == 0 && md_get_version(fd)%100 < 2) { @@ -1188,9 +1209,9 @@ int move_spare(char *from_devname, char *to_devname, dev_t devid) sprintf(devname, "%d:%d", major(devid), minor(devid)); devlist.disposition = 'r'; - if (Manage_subdevs(from_devname, fd2, &devlist, -1, 0, NULL) == 0) { + if (Manage_subdevs(from_devname, fd2, &devlist, -1, 0, NULL, 0) == 0) { devlist.disposition = 'a'; - if (Manage_subdevs(to_devname, fd1, &devlist, -1, 0, NULL) == 0) { + if (Manage_subdevs(to_devname, fd1, &devlist, -1, 0, NULL, 0) == 0) { /* make sure manager is aware of changes */ ping_manager(to_devname); ping_manager(from_devname); @@ -1198,7 +1219,7 @@ int move_spare(char *from_devname, char *to_devname, dev_t devid) close(fd2); return 1; } - else Manage_subdevs(from_devname, fd2, &devlist, -1, 0, NULL); + else Manage_subdevs(from_devname, fd2, &devlist, -1, 0, NULL, 0); } close(fd1); close(fd2); |