summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2014-06-12 13:46:25 +0200
committerThomas Haller <thaller@redhat.com>2014-06-16 19:18:57 +0200
commit524fc6d454e063cd84b004d23e2a0ccc163b8588 (patch)
treea382e1236874d1f9c7e457930eccd41670778217
parent332420ffecfb396b7855f72dcbc067306a862339 (diff)
downloadNetworkManager-524fc6d454e063cd84b004d23e2a0ccc163b8588.tar.gz
core: preserve reason on device deactivation while pre-down (fix tearing down slave when deactivating master)
When delaying the deactivation of a device during dispatcher-pre-down, we must preseve the reason to pass it on. This is especially important, because nm_device_slave_notify_release() checks for the reason, and does not deactivate the slave if no reason is given. This error caused slaves the be left up when deactivating the master. Also update the call to nm_device_slave_notify_release() to ensure we have a valid state reason when configuring the slave. This would have pointed out the issue and would even work around it. Regression introduced by commit d00e2147de148bcec1d32023bda8a90dab552a18. Signed-off-by: Thomas Haller <thaller@redhat.com>
-rw-r--r--src/devices/nm-device.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index b1bf887ebf..7fca6efb4e 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -217,6 +217,7 @@ typedef struct {
gpointer act_source6_func;
guint recheck_assume_id;
guint dispatcher_id;
+ NMDeviceStateReason dispatcher_pre_down_reason;
/* Link stuff */
guint link_connected_id;
@@ -831,8 +832,12 @@ nm_device_release_one_slave (NMDevice *dev, NMDevice *slave, gboolean configure)
reason = NM_DEVICE_STATE_REASON_NONE;
else if (priv->state == NM_DEVICE_STATE_FAILED)
reason = NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED;
- else
+ else if (priv->state_reason != NM_DEVICE_STATE_REASON_NONE)
reason = priv->state_reason;
+ else {
+ g_warn_if_reached ();
+ reason = NM_DEVICE_STATE_REASON_UNKNOWN;
+ }
nm_device_slave_notify_release (info->slave, reason);
free_slave_info (info);
@@ -6530,7 +6535,7 @@ dispatcher_pre_down_done (guint call_id, gpointer user_data)
g_return_if_fail (call_id == priv->dispatcher_id);
priv->dispatcher_id = 0;
- nm_device_queue_state (self, NM_DEVICE_STATE_DISCONNECTED, NM_DEVICE_STATE_REASON_NONE);
+ nm_device_queue_state (self, NM_DEVICE_STATE_DISCONNECTED, priv->dispatcher_pre_down_reason);
}
static void
@@ -6709,6 +6714,7 @@ _set_state_full (NMDevice *device,
nm_act_request_get_connection (req),
device);
} else {
+ priv->dispatcher_pre_down_reason = reason;
if (!nm_dispatcher_call (DISPATCHER_ACTION_PRE_DOWN,
nm_act_request_get_connection (req),
device,