[systemd-devel] Swap gets activated twice (through fstab and gpt generators)

Lennart Poettering lennart at poettering.net
Tue Jan 27 16:05:28 PST 2015


On Tue, 27.01.15 23:29, Jóhann B. Guðmundsson (johannbg at gmail.com) wrote:

> 
> On 01/27/2015 10:48 PM, Lennart Poettering wrote:
> >Another idea might be to simply accept that activating the swap by two
> >names at the same time can happen concurrently, and teach mkswap in
> >some way to handle this gracefully.
> >
> >For example, mkswap could learn a new switch --idempotent or so, which
> >we could always pass from systemd. If set and if activating the swap
> >fails with EBUSY because the swap is already activated it would eat
> >that up and return success.
> 
> Is not the problem here that we are using two generators to parse this?

No, not at all.

The problem is simply that we cannot know in advance that /dev/sda7
and /dev/disk/by-uuid/c0e7978b-f82b-4b7f-b72b-6717f6909abc will
eventually refer to the same device. We hence have to enqueue jobs to
activate both, but finally, when the device actually appears and we
realize both names actually refer to the same device, we need to
handle this gracefully, instead of actually invoking mkswap on both of
them.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list