diff options
author | pjd <pjd@FreeBSD.org> | 2006-04-18 13:52:11 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2006-04-18 13:52:11 +0000 |
commit | 7a0948ca69080690b83bccd7022c331c49589ab8 (patch) | |
tree | d03537bf95aedf59473ca581b117708f14f381c7 /sys/geom/raid3 | |
parent | a3ec5442cc70f57d7aa6232d37a55acf640173dd (diff) | |
download | FreeBSD-src-7a0948ca69080690b83bccd7022c331c49589ab8.zip FreeBSD-src-7a0948ca69080690b83bccd7022c331c49589ab8.tar.gz |
Fix storing offset of already synchronized data. Offset in entire array was
stored in metadata instead of an offset in single disk.
After reboot/crash synchronization process started from a wrong offset
skipping (not synchronizing) part of the component which can lead to data
corrutpion (when synchronization process was interrupted on initial
synchronization) or other strange situations like 'graid3 status' showing
value more than 100%.
Reported, reviewed and tested by: ru
Reported by: Dmitry Morozovsky <marck@rinet.ru>
MFC after: 1 day
Diffstat (limited to 'sys/geom/raid3')
-rw-r--r-- | sys/geom/raid3/g_raid3.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/geom/raid3/g_raid3.c b/sys/geom/raid3/g_raid3.c index 55687c6..71a8399 100644 --- a/sys/geom/raid3/g_raid3.c +++ b/sys/geom/raid3/g_raid3.c @@ -723,10 +723,12 @@ g_raid3_fill_metadata(struct g_raid3_disk *disk, struct g_raid3_metadata *md) md->md_no = disk->d_no; md->md_syncid = disk->d_sync.ds_syncid; md->md_dflags = (disk->d_flags & G_RAID3_DISK_FLAG_MASK); - if (disk->d_state == G_RAID3_DISK_STATE_SYNCHRONIZING) - md->md_sync_offset = disk->d_sync.ds_offset_done; - else + if (disk->d_state != G_RAID3_DISK_STATE_SYNCHRONIZING) md->md_sync_offset = 0; + else { + md->md_sync_offset = + disk->d_sync.ds_offset_done / (sc->sc_ndisks - 1); + } if (disk->d_consumer != NULL && disk->d_consumer->provider != NULL) pp = disk->d_consumer->provider; else |