Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions lib/hyper/node/img/mutable.ex
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,20 @@ defmodule Hyper.Node.Img.Mutable do
@impl true
def handle_info(:idle_timeout, state), do: {:noreply, state}

@impl true
# Each privileged command runs through `System.cmd`, which links a transient
# port to this process and returns only once that command has finished. Because
# we trap exits (for `terminate/2` teardown), the now-defunct port's exit lands
# here afterwards -- stale by construction, whatever its reason -- so ignore it.
def handle_info({:EXIT, port, _reason}, state) when is_port(port), do: {:noreply, state}

@impl true
# No process is deliberately linked here beyond those transient command ports,
# so a linked *process* EXIT is a genuine fault: propagate its reason (so
# terminate/2 still runs teardown) rather than crash opaquely on an unmatched
# message.
def handle_info({:EXIT, _pid, reason}, state), do: {:stop, reason, state}

@impl true
def terminate(_reason, state) do
# Destroy the thin volume, then release the image (its monitor on us also
Expand Down
14 changes: 14 additions & 0 deletions lib/hyper/node/img/server.ex
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,20 @@ defmodule Hyper.Node.Img.Server do
{:noreply, state}
end

@impl true
# Each privileged command runs through `System.cmd`, which links a transient
# port to this process and returns only once that command has finished. Because
# we trap exits (for `terminate/2` teardown), the now-defunct port's exit lands
# here afterwards -- stale by construction, whatever its reason -- so ignore it.
def handle_info({:EXIT, port, _reason}, state) when is_port(port), do: {:noreply, state}

@impl true
# No process is deliberately linked here beyond those transient command ports,
# so a linked *process* EXIT is a genuine fault: propagate its reason (so
# terminate/2 still runs teardown) rather than crash opaquely on an unmatched
# message.
def handle_info({:EXIT, _pid, reason}, state), do: {:stop, reason, state}

@impl true
def terminate(_reason, %State{dm_names: dm_names}) do
# Remove top-down (a snapshot's origin is the device below it). Layers are
Expand Down
14 changes: 14 additions & 0 deletions lib/hyper/node/img/thin_pool.ex
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,20 @@ defmodule Hyper.Node.Img.ThinPool do
{:reply, :ok, id_free(state, id)}
end

@impl true
# Each privileged command runs through `System.cmd`, which links a transient
# port to this process and returns only once that command has finished. Because
# we trap exits (for `terminate/2` teardown), the now-defunct port's exit lands
# here afterwards -- stale by construction, whatever its reason -- so ignore it.
def handle_info({:EXIT, port, _reason}, state) when is_port(port), do: {:noreply, state}

@impl true
# No process is deliberately linked here beyond those transient command ports,
# so a linked *process* EXIT is a genuine fault: propagate its reason (so
# terminate/2 still runs teardown) rather than crash opaquely on an unmatched
# message.
def handle_info({:EXIT, _pid, reason}, state), do: {:stop, reason, state}

@impl true
def terminate(_reason, state) do
_ = SuidHelper.Dmsetup.remove(@pool_name)
Expand Down
14 changes: 14 additions & 0 deletions lib/hyper/node/layer/server.ex
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,20 @@ defmodule Hyper.Node.Layer.Server do
{:noreply, state}
end

@impl true
# Each privileged command runs through `System.cmd`, which links a transient
# port to this process and returns only once that command has finished. Because
# we trap exits (for `terminate/2` teardown), the now-defunct port's exit lands
# here afterwards -- stale by construction, whatever its reason -- so ignore it.
def handle_info({:EXIT, port, _reason}, state) when is_port(port), do: {:noreply, state}

@impl true
# No process is deliberately linked here beyond those transient command ports,
# so a linked *process* EXIT is a genuine fault: propagate its reason (so
# terminate/2 still runs teardown) rather than crash opaquely on an unmatched
# message.
def handle_info({:EXIT, _pid, reason}, state), do: {:stop, reason, state}

@impl true
def terminate(_reason, %State{blk_path: blk_path}) do
case SuidHelper.Losetup.detach(blk_path) do
Expand Down
Loading