summaryrefslogtreecommitdiffstats
path: root/Grow.c
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2006-03-29 06:28:07 +0000
committerNeil Brown <neilb@suse.de>2006-03-29 06:28:07 +0000
commit9860f2711da70977cdb1fa06a4c51c0e515d3237 (patch)
treed6517fb15c2ac78f1d7ae3cc9f4a7bf573f62264 /Grow.c
parent7ef02d01432952ee677beca7b0f90b653b3d336b (diff)
downloadmdadm-9860f2711da70977cdb1fa06a4c51c0e515d3237.tar.gz
mdadm-9860f2711da70977cdb1fa06a4c51c0e515d3237.tar.xz
mdadm-9860f2711da70977cdb1fa06a4c51c0e515d3237.zip
Bug fixes to pass test suite
Signed-off-by: Neil Brown <neilb@suse.de>
Diffstat (limited to 'Grow.c')
-rw-r--r--Grow.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/Grow.c b/Grow.c
index de53df1..125606c 100644
--- a/Grow.c
+++ b/Grow.c
@@ -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. */