Bug fixes to pass test suite

Signed-off-by: Neil Brown <neilb@suse.de>
This commit is contained in:
Neil Brown 2006-03-29 06:28:07 +00:00
parent 7ef02d0143
commit 9860f2711d
5 changed files with 23 additions and 14 deletions

23
Grow.c
View File

@ -500,14 +500,21 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
* other from happening. Later we could block
* resync for the duration via 'sync_action'...
*/
if (raid_disks >= 0)
if (raid_disks > 0) {
array.raid_disks = raid_disks;
if (size >= 0)
if (ioctl(fd, SET_ARRAY_INFO, &array) != 0) {
fprintf(stderr, Name ": Cannot set raid-devices for %s: %s\n",
devname, strerror(errno));
return 1;
}
}
if (size >= 0) {
array.size = size;
if (ioctl(fd, SET_ARRAY_INFO, &array) != 0) {
fprintf(stderr, Name ": Cannot set device size/shape for %s: %s\n",
devname, strerror(errno));
return 1;
if (ioctl(fd, SET_ARRAY_INFO, &array) != 0) {
fprintf(stderr, Name ": Cannot set device size for %s: %s\n",
devname, strerror(errno));
return 1;
}
}
return 0;
@ -869,8 +876,6 @@ int Grow_restart(struct supertype *st, struct mdinfo *info, int *fdlist, int cnt
fd = open(backup_file, O_RDONLY);
if (fd<0)
continue;
if (lseek(fd, 4096, 0) != 4096)
continue;
} else {
fd = fdlist[i];
if (fd < 0)
@ -909,7 +914,7 @@ int Grow_restart(struct supertype *st, struct mdinfo *info, int *fdlist, int cnt
/* There should be a duplicate backup superblock 4k before here */
if (lseek64(fd, -4096, 1) < 0 ||
read(fd, buf, 4096) != 4096 ||
memcmp(buf, &bsb, sizeof(buf)) != 0)
memcmp(buf, &bsb, sizeof(bsb)) != 0)
continue; /* Cannot find leading superblock */
/* Now need the data offsets for all devices. */

2
Kill.c
View File

@ -50,12 +50,14 @@ int Kill(char *dev, int force, int quiet)
if (!quiet)
fprintf(stderr, Name ": Couldn't open %s for write - not zeroing\n",
dev);
close(fd);
return 1;
}
st = guess_super(fd);
if (st == NULL) {
if (!quiet)
fprintf(stderr, Name ": Unrecognised md component device - %s\n", dev);
close(fd);
return 1;
}
rv = st->ss->load_super(st, fd, &super, dev);

5
test
View File

@ -63,7 +63,10 @@ fi
# mdadm always adds --quiet, and we want to see any unexpected messages
mdadm() {
$mdadm --quiet "$@"
case $* in
*-C* ) $mdadm --quiet "$@" --auto=yes;;
* ) $mdadm --quiet "$@"
esac
}
# check various things

View File

@ -49,7 +49,6 @@ mdadm -As -c $conf
echo "DEVICE $devlist" > $conf
mdadm -Db $md1 >> $conf
eval $tst
mdadm --assemble --scan --config=$conf $md1
eval $tst
echo PING >&2

View File

@ -32,10 +32,10 @@ fi
mdadm -S $md0
mdadm --assemble -R $md0 --bitmap=$bmf $dev2
mdadm $md0 --add $dev1
check recovery
dirty4=`mdadm -X $bmf | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`
mdadm $md0 --add $dev1
#it is too fast# check recovery
check wait
sleep 4
dirty5=`mdadm -X $bmf | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'`