Changeset ed5367b in mainline for uspace/srv/sysman/units/unit_mnt.c


Ignore:
Timestamp:
2019-08-07T10:01:13Z (5 years ago)
Author:
Matthieu Riolo <matthieu.riolo@…>
Children:
a097c50
Parents:
68ae40a
git-author:
Michal Koutný <xm.koutny+hos@…> (2015-11-05 01:52:07)
git-committer:
Matthieu Riolo <matthieu.riolo@…> (2019-08-07 10:01:13)
Message:

sysman: Implement stopping units

Currently fails service monitoring because of taskman flawed event flags.
However, job closure works well.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/sysman/units/unit_mnt.c

    r68ae40a red5367b  
    229229}
    230230
     231static int unit_mnt_stop(unit_t *unit)
     232{
     233        unit_mnt_t *u_mnt = CAST_MNT(unit);
     234        assert(u_mnt);
     235        /* autostart implies blocking */
     236        assert(!u_mnt->autostart || u_mnt->blocking);
     237
     238       
     239        // TODO think about unit's lifecycle (is STOPPED only acceptable?)
     240        // note: we should never hit STATE_STARTING, since it'd mean there are
     241        //       two jobs running at once (unless job cancellation is implemented)
     242        assert(unit->state == STATE_STARTED);
     243
     244        /*
     245         * We don't expect unmount to be blocking, since if some files are
     246         * being used, it'd return EBUSY immediately. That's why we call
     247         * unmount synchronously in the event loop fibril.
     248         */
     249        int rc = unmount(u_mnt->mountpoint);
     250
     251        if (rc == EOK) {
     252                unit->state = STATE_STOPPED;
     253                return EOK;
     254        } else if (rc == EBUSY) {
     255                assert(unit->state == STATE_STARTED);
     256                return EBUSY;
     257        } else {
     258                /*
     259                 * Mount may be still usable, but be conservative and mark unit
     260                 * as failed.
     261                 */
     262                unit->state = STATE_FAILED;
     263                return rc;
     264        }
     265}
     266
    231267static void unit_mnt_exposee_created(unit_t *unit)
    232268{
Note: See TracChangeset for help on using the changeset viewer.