if (!restart && strncmp(backup_file, MAP_DIR, strlen(MAP_DIR)) != 0) {
char *bu = make_backup(sys_name);
- symlink(backup_file, bu);
+ if (symlink(backup_file, bu))
+ pr_err("Recording backup file in " MAP_DIR "failed: %s\n",
+ strerror(errno));
free(bu);
}
switch (info->array.level) {
default:
- return "Cannot understand this RAID level";
+ return "No reshape is possibly for this RAID level";
+ case LEVEL_LINEAR:
+ if (info->delta_disks != UnSet)
+ return "Only --add is supported for LINEAR, setting --raid-disks is not needed";
+ else
+ return "Only --add is supported for LINEAR, other --grow options are not meaningful";
case 1:
/* RAID1 can convert to RAID1 with different disks, or
* raid5 with 2 disks, or
switch (re->level) {
case 4:
- re->before.layout = 0;
re->after.layout = 0;
break;
case 5:
ret_val = 0;
dprintf("Array size changed");
}
- dprintf(" from %llu to %llu.\n",
- current_size, new_size);
+ dprintf_cont(" from %llu to %llu.\n",
+ current_size, new_size);
}
sysfs_free(info);
} else
if (s->size == MAX_SIZE)
s->size = 0;
array.size = s->size;
- if ((unsigned)array.size != s->size) {
+ if (s->size & ~INT32_MAX) {
/* got truncated to 32bit, write to
* component_size instead
*/
int err;
err = remove_disks_for_takeover(st, sra, array.layout);
if (err) {
- dprintf(Name": Array cannot be reshaped\n");
+ dprintf("Array cannot be reshaped\n");
if (cfd > -1)
close(cfd);
rv = 1;
char *ep;
unsigned long long position = strtoull(buf, &ep, 0);
- dprintf(Name": Read sync_max sysfs entry is: %s\n", buf);
+ dprintf("Read sync_max sysfs entry is: %s\n", buf);
if (!(ep == buf || (*ep != 0 && *ep != '\n' && *ep != ' '))) {
position *= get_data_disks(level,
info->new_layout,
if (info2.space_before == 0 &&
info2.space_after == 0) {
/* Metadata doesn't support data_offset changes */
- return 1;
+ pr_err("%s: Metadata version doesn't support"
+ " data_offset changes\n", devname);
+ goto fallback;
}
if (before > info2.space_before)
before = info2.space_before;
unsigned long long array_size;
int done;
struct mdinfo *sra = NULL;
+ char buf[20];
/* when reshaping a RAID0, the component_size might be zero.
* So try to fix that up.
goto release;
}
- if (st->ss->external && restart && (info->reshape_progress == 0)) {
+ if (st->ss->external && restart && (info->reshape_progress == 0) &&
+ !((sysfs_get_str(info, NULL, "sync_action", buf, sizeof(buf)) > 0) &&
+ (strncmp(buf, "reshape", 7) == 0))) {
/* When reshape is restarted from '0', very begin of array
* it is possible that for external metadata reshape and array
* configuration doesn't happen.
*/
ping_monitor(container);
- if (!forked && !check_env("MDADM_NO_SYSTEMCTL"))
+ if (!forked && !freeze_reshape && !check_env("MDADM_NO_SYSTEMCTL"))
if (continue_via_systemd(container))
return 0;
return 1;
default: /* parent */
if (!freeze_reshape)
- printf(Name ": multi-array reshape continues"
- " in background\n");
+ printf("%s: multi-array reshape continues"
+ " in background\n", Name);
return 0;
case 0: /* child */
map_fork();
fd = open_dev(mdstat->devnm);
if (fd < 0) {
- printf(Name ": Device %s cannot be opened for reshape.",
- adev);
+ pr_err("Device %s cannot be opened for reshape.\n", adev);
break;
}
* This is possibly interim until the behaviour of
* reshape_array is resolved().
*/
- printf(Name ": Multiple reshape execution detected for "
- "device %s.", adev);
+ printf("%s: Multiple reshape execution detected for "
+ "device %s.\n", Name, adev);
close(fd);
break;
}
st->ss->free_super(st);
offsets[j] = dinfo.data_offset * 512;
}
- printf(Name ": restoring critical section\n");
+ printf("%s: restoring critical section\n", Name);
if (restore_stripes(fdlist, offsets,
info->array.raid_disks,
dprintf("Grow continue is run for ");
if (st->ss->external == 0) {
int d;
- dprintf("native array (%s)\n", devname);
+ dprintf_cont("native array (%s)\n", devname);
if (ioctl(fd, GET_ARRAY_INFO, &array.array) < 0) {
pr_err("%s is not an active md array -"
" aborting\n", devname);
char *container;
if (subarray) {
- dprintf("subarray (%s)\n", subarray);
+ dprintf_cont("subarray (%s)\n", subarray);
container = st->container_devnm;
cfd = open_dev_excl(st->container_devnm);
} else {
container = st->devnm;
close(fd);
cfd = open_dev_excl(st->devnm);
- dprintf("container (%s)\n", container);
+ dprintf_cont("container (%s)\n", container);
fd = cfd;
}
if (cfd < 0) {
close(cfd);
ret_val = reshape_container(st->container_devnm, NULL, mdfd,
st, info, 0, backup_file,
- 0, 1,
+ 0, forked,
1 | info->reshape_active,
freeze_reshape);
} else