[systemd-devel] [PATCH] device: Add stub serialization methods to enable job serialization.

Lennart Poettering lennart at poettering.net
Thu May 15 16:24:42 PDT 2014


On Tue, 06.05.14 19:08, Michael Marineau (michael.marineau at coreos.com) wrote:

> If a unit type doesn't provide its own serialization methods then
> none of the generic serialization will happen either. For devices this
> means jobs used for waiting on device dependencies are dropped during
> reloads, breaking dependency state that was relying on those jobs.

Oh yuck! This is quite some bug, which I figure is the source of quite a
few bug reports we had where people were reloading the daemon during the
boot process...

I commited a different fix now which avoids installing stub callbacks,
and simply fixes to the core always serialize the job regardless if the
unit has anything else to serialize...

Please test!

> ---
>  src/core/device.c | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/src/core/device.c b/src/core/device.c
> index 444286e..07c0860 100644
> --- a/src/core/device.c
> +++ b/src/core/device.c
> @@ -130,6 +130,25 @@ static void device_dump(Unit *u, FILE *f, const char *prefix) {
>                  prefix, strna(d->sysfs));
>  }
>  
> +static int device_serialize(Unit *u, FILE *f, FDSet *fds) {
> +        assert(u);
> +        assert(f);
> +        assert(fds);
> +
> +        return 0;
> +}
> +
> +static int device_deserialize_item(Unit *u, const char *key, const char *value, FDSet *fds) {
> +        assert(u);
> +        assert(key);
> +        assert(value);
> +        assert(fds);
> +
> +        log_debug("Unknown serialization key '%s'", key);
> +
> +        return 0;
> +}
> +
>  _pure_ static UnitActiveState device_active_state(Unit *u) {
>          assert(u);
>  
> @@ -693,6 +712,9 @@ const UnitVTable device_vtable = {
>  
>          .dump = device_dump,
>  
> +        .serialize = device_serialize,
> +        .deserialize_item = device_deserialize_item,
> +
>          .active_state = device_active_state,
>          .sub_state_to_string = device_sub_state_to_string,
>  


Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list