aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Grosbein <eugen@FreeBSD.org>2024-02-12 07:24:28 +0000
committerEugene Grosbein <eugen@FreeBSD.org>2024-02-17 18:35:20 +0000
commit394ceefc2f2f586f303461428497d3961b89d078 (patch)
treee802cca6da16ebb993c7790ebc3308ef96f83a07
parenta233f7fadfca5cf806201a97e1e200054c7e87c3 (diff)
downloadsrc-394ceefc2f2f.tar.gz
src-394ceefc2f2f.zip
graid: MFC: unbreak Promise RAID1 with 4+ providers
Fix a problem in graid implementation of Promise RAID1 created with 4+ disks. Such an array generally works fine until reboot only due to a bug in metadata writing code. Before the fix, next taste erronously created RAID1E (kind of RAID10) instead of RAID1, hence graid used wrong offsets for I/O operations. The bug did not affect Promise RAID1 arrays with 2 or 3 disks only. Reviewed by: mav Approved-by: re (cperciva) (cherry picked from commit 81092e92ea5184c4eeedad58044d72cfef72dd24) (cherry picked from commit 77814c95994aab102be0e327de788dc1c00c023d)
-rw-r--r--sys/geom/raid/md_promise.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/geom/raid/md_promise.c b/sys/geom/raid/md_promise.c
index 1c22c0756dfd..da2ea3d7da4e 100644
--- a/sys/geom/raid/md_promise.c
+++ b/sys/geom/raid/md_promise.c
@@ -1763,8 +1763,9 @@ g_raid_md_write_promise(struct g_raid_md_object *md, struct g_raid_volume *tvol,
meta->total_disks = vol->v_disks_count;
meta->stripe_shift = ffs(vol->v_strip_size / 1024);
meta->array_width = vol->v_disks_count;
- if (vol->v_raid_level == G_RAID_VOLUME_RL_RAID1 ||
- vol->v_raid_level == G_RAID_VOLUME_RL_RAID1E)
+ if (vol->v_raid_level == G_RAID_VOLUME_RL_RAID1)
+ meta->array_width = 1;
+ else if (vol->v_raid_level == G_RAID_VOLUME_RL_RAID1E)
meta->array_width /= 2;
meta->array_number = vol->v_global_id;
meta->total_sectors = vol->v_mediasize / 512;