Changeset c2f0160 in mainline for uspace/srv/bd/hr/util.c


Ignore:
Timestamp:
2025-05-06T21:31:40Z (5 weeks ago)
Author:
Miroslav Cimerman <mc@…>
Children:
217d0fb
Parents:
d1d355f
Message:

hr: util: add more checks for hotspare addition

File:
1 edited

Legend:

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

    rd1d355f rc2f0160  
    10181018        }
    10191019
     1020        for (size_t i = 0; i < vol->hotspare_no; i++) {
     1021                if (vol->hotspares[i].svc_id == hotspare) {
     1022                        HR_ERROR("%s(): hotspare (%" PRIun ") already used in "
     1023                            "%s\n", __func__, hotspare, vol->devname);
     1024                        rc = EEXIST;
     1025                        goto error;
     1026                }
     1027        }
     1028
    10201029        rc = block_init(hotspare);
    10211030        if (rc != EOK)
     
    10291038        }
    10301039
    1031         if (hs_blkno < vol->truncated_blkno - vol->meta_ops->get_size()) {
     1040        if (hs_blkno - vol->meta_ops->get_size() < vol->truncated_blkno) {
     1041                HR_ERROR("%s(): hotspare (%" PRIun ") doesn't have enough "
     1042                    "blocks\n", __func__, hotspare);
     1043
    10321044                rc = EINVAL;
    10331045                block_fini(hotspare);
Note: See TracChangeset for help on using the changeset viewer.