summaryrefslogtreecommitdiff
path: root/Manage.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2010-12-09 13:06:29 +1100
committerNeilBrown <neilb@suse.de>2010-12-09 13:06:29 +1100
commit833bb0f8f61c576895a2ec90c344c148c08dadba (patch)
treea94afa659cd2d01366009d3b0df2c77d473f92f9 /Manage.c
parent691a36b76f871a63a327641589f41e968b05afa9 (diff)
Allow --update=devicesize with --re-add
This is useful with 1.1 and 1.2 metadata to update the metadata if the device size has changed. The same functionality can be achieved by writing to the device size in sysfs after re-adding normally, but in some cases this might be easier. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'Manage.c')
-rw-r--r--Manage.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/Manage.c b/Manage.c
index a203ec9b..81fa986d 100644
--- a/Manage.c
+++ b/Manage.c
@@ -325,7 +325,8 @@ 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)
+ struct mddev_dev *devlist, int verbose, int test,
+ char *update)
{
/* do something to each dev.
* devmode can be
@@ -691,6 +692,24 @@ int Manage_subdevs(char *devname, int fd,
remove_partitions(tfd);
close(tfd);
tfd = -1;
+ if (update) {
+ int rv = -1;
+ tfd = dev_open(dv->devname, O_RDWR);
+
+ if (tfd >= 0)
+ rv = st->ss->update_super(
+ st, NULL, update,
+ devname, verbose, 0, NULL);
+ if (rv == 0)
+ rv = tst->ss->store_super(st, tfd);
+ close(tfd);
+ tfd = -1;
+ if (rv != 0) {
+ fprintf(stderr, Name ": failed to update"
+ " superblock during re-add\n");
+ return 1;
+ }
+ }
/* don't even try if disk is marked as faulty */
errno = 0;
if (ioctl(fd, ADD_NEW_DISK, &disc) == 0) {