Changeset 4d30c475 in mainline


Ignore:
Timestamp:
2025-03-06T19:40:24Z (2 months ago)
Author:
Miroslav Cimerman <mc@…>
Children:
6123753
Parents:
b15e534
Message:

hr: raid1.c: fix rebuild

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/bd/hr/raid1.c

    rb15e534 r4d30c475  
    533533        hr_add_ba_offset(vol, &ba);
    534534
     535        /*
     536         * XXX: this is useless here after simplified DI, because
     537         * rebuild cannot be triggered while ongoing rebuild
     538         */
    535539        fibril_rwlock_read_lock(&vol->extents_lock);
    536540
     
    538542
    539543        while (left != 0) {
    540                 if (vol->halt_please) {
    541                         fibril_rwlock_read_unlock(&vol->extents_lock);
    542                         fibril_mutex_lock(&vol->halt_lock);
    543                         fibril_mutex_unlock(&vol->halt_lock);
    544                         fibril_rwlock_read_lock(&vol->extents_lock);
    545                 }
    546 
    547544                cnt = min(max_blks, left);
    548545
     
    573570
    574571        hr_update_ext_status(vol, rebuild_idx, HR_EXT_ONLINE);
     572
    575573        /*
    576574         * We can be optimistic here, if some extents are
     
    723721        hr_extent_t *ext, *rebuild_ext = &vol->extents[rebuild_idx];
    724722
     723        fibril_rwlock_read_lock(&vol->states_lock);
     724        hr_ext_status_t rebuild_ext_status = rebuild_ext->status;
     725        fibril_rwlock_read_unlock(&vol->states_lock);
     726
     727        if (rebuild_ext_status != HR_EXT_REBUILD)
     728                return EINVAL;
     729
    725730        for (size_t i = 0; i < vol->extent_no; i++) {
    726731                fibril_rwlock_read_lock(&vol->states_lock);
    727 
    728732                ext = &vol->extents[i];
    729                 if (ext->status != HR_EXT_ONLINE)
     733                if (ext->status != HR_EXT_ONLINE) {
     734                        fibril_rwlock_read_unlock(&vol->states_lock);
    730735                        continue;
    731 
     736                }
    732737                fibril_rwlock_read_unlock(&vol->states_lock);
    733738
Note: See TracChangeset for help on using the changeset viewer.