Skip to content

Commit

Permalink
graid: MFC: unbreak Promise RAID1 with 4+ providers
Browse files Browse the repository at this point in the history
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

(cherry picked from commit 81092e92ea5184c4eeedad58044d72cfef72dd24)
  • Loading branch information
Eugene Grosbein authored and laffer1 committed Mar 28, 2024
1 parent ae57157 commit 3d3c92e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sys/geom/raid/md_promise.c
Original file line number Diff line number Diff line change
Expand Up @@ -1765,8 +1765,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;
Expand Down

0 comments on commit 3d3c92e

Please sign in to comment.