Changeset 1a9174e in mainline for uspace/srv/volsrv/volsrv.c


Ignore:
Timestamp:
2018-06-29T15:35:50Z (6 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d3b2ffa
Parents:
72c72d4
git-author:
Jiri Svoboda <jiri@…> (2018-06-28 18:34:52)
git-committer:
Jiri Svoboda <jiri@…> (2018-06-29 15:35:50)
Message:

Volume server needs to react to partitions being removed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/volsrv/volsrv.c

    r72c72d4 r1a9174e  
    144144        log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_info_srv(%zu)",
    145145            sid);
    146         rc = vol_part_find_by_id(sid, &part);
     146        rc = vol_part_find_by_id_ref(sid, &part);
    147147        if (rc != EOK) {
    148148                async_answer_0(icall_handle, ENOENT);
     
    153153        if (rc != EOK) {
    154154                async_answer_0(icall_handle, EIO);
    155                 return;
     155                goto error;
    156156        }
    157157
     
    161161                async_answer_0(chandle, EREFUSED);
    162162                async_answer_0(icall_handle, EREFUSED);
    163                 return;
     163                goto error;
    164164        }
    165165
     
    167167                async_answer_0(chandle, EINVAL);
    168168                async_answer_0(icall_handle, EINVAL);
    169                 return;
     169                goto error;
    170170        }
    171171
     
    175175                async_answer_0(chandle, rc);
    176176                async_answer_0(icall_handle, rc);
    177                 return;
    178         }
    179 
    180         async_answer_0(icall_handle, EOK);
     177                goto error;
     178        }
     179
     180        async_answer_0(icall_handle, EOK);
     181error:
     182        vol_part_del_ref(part);
    181183}
    182184
     
    190192        log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_eject_srv(%zu)", sid);
    191193
    192         rc = vol_part_find_by_id(sid, &part);
     194        rc = vol_part_find_by_id_ref(sid, &part);
    193195        if (rc != EOK) {
    194196                async_answer_0(icall_handle, ENOENT);
    195                 return;
     197                goto error;
    196198        }
    197199
     
    199201        if (rc != EOK) {
    200202                async_answer_0(icall_handle, EIO);
    201                 return;
    202         }
    203 
    204         async_answer_0(icall_handle, EOK);
     203                goto error;
     204        }
     205
     206        async_answer_0(icall_handle, EOK);
     207error:
     208        vol_part_del_ref(part);
    205209}
    206210
     
    214218        log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_empty_srv(%zu)", sid);
    215219
    216         rc = vol_part_find_by_id(sid, &part);
     220        rc = vol_part_find_by_id_ref(sid, &part);
    217221        if (rc != EOK) {
    218222                async_answer_0(icall_handle, ENOENT);
     
    223227        if (rc != EOK) {
    224228                async_answer_0(icall_handle, EIO);
    225                 return;
    226         }
    227 
    228         async_answer_0(icall_handle, EOK);
     229                goto error;
     230        }
     231
     232        async_answer_0(icall_handle, EOK);
     233error:
     234        vol_part_del_ref(part);
    229235}
    230236
     
    292298        }
    293299
    294         rc = vol_part_find_by_id(sid, &part);
     300        rc = vol_part_find_by_id_ref(sid, &part);
    295301        if (rc != EOK) {
    296302                free(label);
     
    303309                free(label);
    304310                async_answer_0(icall_handle, rc);
     311                vol_part_del_ref(part);
    305312                return;
    306313        }
Note: See TracChangeset for help on using the changeset viewer.