machined: simplify reference handling for units
Before, we'd unref from machine_stop_unit, still keeping the unit name around, and only forget the name later, when garbage collecting. If we didn't call manager_stop_unit(), then we wouldn't do the unref. Let's unref at the same point where we do garbage collection, so that it is always true that iff we have the name generated with AddRef=1, then have a reference to the unit, and as soon as we forget the name, we drop the reference. This should fix the issue when repeated systemd-nspawn --register=yes fails with "scope already exists" error. Incidentally, this fixes an error in the code path where r was used instead of q.
Loading
Please register or sign in to comment