Fix: check for removal of session's shm_path in destroy()
When a session is created with an explicit shm_path,
the consumer daemon will create its shared memory files
at that location and will *not* unlink them. This is normal
as the intention of that feature is to make it possible
to retrieve the content of those files should a crash occur.
To ensure the content of those files can be used, the
sessiond daemon will replicate the content of the metadata
cache in a metadata file.
On clean-up, it is expected that the consumer daemon will
unlink the shared memory files and that the session daemon
will unlink the metadata file. Then, the session's directory
in the shm path can be removed.
Unfortunately, a flaw in the design of the sessiond's and
consumerd's tear down of channels makes it impossible to
determine when the sessiond _and_ the consumerd have both
destroyed their representation of a channel. For one, the
unlinking, close, and rmdir happen in deferred 'call_rcu'
callbacks in both daemons.
However, it is also impossible for the sessiond to know when
the consumer daemon is done destroying its channel(s) since
it occurs as a reaction to the closing of the channel's file
descriptor. There is no resulting communication initiated
from the consumerd to the sessiond to confirm that the
operation is completed (and was successful).
Until this is all fixed, the session daemon checks for the
removal of the session's shm path which makes it possible
to safely advertise a session as having been destroyed.
Prior to this fix, it was not possible to reliably save
a session making use of the --shm-path option, destroy it,
and load it again. This is because the creation of the
session would fail upon seeing the session's shm path
already in existence.
Note that none of the error paths in the check for the
directory's existence return an error. This is normal
as there isn't much that can be done. The session will
be destroyed properly, except that we can't offer the
guarantee that the same session can be re-created.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
This page took 0.02866 seconds and 5 git commands to generate.