Merge lp:~morphis/network-manager/fix-lp1560793 into lp:~phablet-team/network-manager/vivid-phone-overlay

Proposed by Simon Fels
Status: Merged
Approved by: Tony Espy
Approved revision: 975
Merged at revision: 973
Proposed branch: lp:~morphis/network-manager/fix-lp1560793
Merge into: lp:~phablet-team/network-manager/vivid-phone-overlay
Diff against target: 104 lines (+84/-0)
3 files modified
debian/changelog (+11/-0)
debian/patches/clear-requested-scan-when-supplicant-goes-down.patch (+72/-0)
debian/patches/series (+1/-0)
To merge this branch: bzr merge lp:~morphis/network-manager/fix-lp1560793
Reviewer Review Type Date Requested Status
Tony Espy Approve
Review via email: mp+289877@code.launchpad.net

Commit message

Clear flag which indicates if a new scan is requested or not when a
WiFi interface is removed from supplicant to prevent us from not
issuing a scan again when we the interface becomes available again.

To post a comment you must log in.
975. By Simon Fels

Add missing patch

Revision history for this message
Tony Espy (awe) :
review: Approve
Revision history for this message
Tony Espy (awe) wrote :

Note, I will add that although the proposed fix makes sense, as there is a new race condition that was introduced by the last upload, the odds of hitting this are low the disable WiFi event needs to happen after a scan has been requested, but before it's results are available.

I tested over 60 iterations on krillin ( rc-proposed / 290 ) and arale ( rc-proposed / 238 ) and never hit this bug. Note, I also made sure to have the Nearby scope active, as this increases the frequency of WiFi scans to every 10-12s.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2016-03-23 10:02:09 +0000
3+++ debian/changelog 2016-03-23 10:20:36 +0000
4@@ -1,3 +1,14 @@
5+network-manager (0.9.10.0-4ubuntu15.1.11) UNRELEASED; urgency=medium
6+
7+ [ Vicamo Yang ]
8+ * d/p/clear-requested-scan-when-supplicant-goes-down.patch: Clear
9+ flag which indicates if a new scan is requested or not when a
10+ WiFi interface is removed from supplicant to prevent us from not
11+ issueing a scan again when we the interface becomes available
12+ again (LP: #1560793)
13+
14+ -- Simon Fels <simon.fels@canonical.com> Wed, 23 Mar 2016 11:12:25 +0100
15+
16 network-manager (0.9.10.0-4ubuntu15.1.10) vivid; urgency=medium
17
18 [ Vicamo Yang ]
19
20=== added file 'debian/patches/clear-requested-scan-when-supplicant-goes-down.patch'
21--- debian/patches/clear-requested-scan-when-supplicant-goes-down.patch 1970-01-01 00:00:00 +0000
22+++ debian/patches/clear-requested-scan-when-supplicant-goes-down.patch 2016-03-23 10:20:36 +0000
23@@ -0,0 +1,72 @@
24+From 22aaf463499c025bdf08132453092e9d34bc4bdc Mon Sep 17 00:00:00 2001
25+From: You-Sheng Yang <vicamo@gmail.com>
26+Date: Wed, 23 Mar 2016 16:31:20 +0800
27+Subject: [PATCH] wifi: clear requested_scan flag at release
28+
29+When wifi supplicant interface switches its state from unavailable to
30+ready, NM is supposed to request for a initial scan. However, that's
31+only made when there is no pending scan request, or specifically, when
32+`priv->requested_scan` is FALSE.
33+
34+Under stressing tests, switching WiFi on and immediately off and
35+immediately on ..., it's possible that `priv->requested_scan` remains
36+TRUE when the underlying supplicant interface has been released. As a
37+result, when it's enabled again, switching state from unavailable to
38+ready, the scan request will not be made forever until NM restarts or
39+system reboots.
40+
41+This patch clears that requested_scan when supplicant interface is to be
42+released.
43+
44+diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c
45+index 4723ead..0ae31fd 100644
46+--- a/src/devices/wifi/nm-device-wifi.c
47++++ b/src/devices/wifi/nm-device-wifi.c
48+@@ -291,16 +291,23 @@ static void
49+ supplicant_interface_release (NMDeviceWifi *self)
50+ {
51+ NMDeviceWifiPrivate *priv;
52+
53+ g_return_if_fail (self != NULL);
54+
55+ priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
56+
57++ if (priv->requested_scan) {
58++ nm_log_dbg (LOGD_WIFI_SCAN, "(%s): reset requested_scan flag to FALSE",
59++ nm_device_get_iface (NM_DEVICE (self)));
60++ priv->requested_scan = FALSE;
61++ nm_device_remove_pending_action (NM_DEVICE (self), "scan", TRUE);
62++ }
63++
64+ cancel_pending_scan (self);
65+
66+ /* Reset the scan interval to be pretty frequent when disconnected */
67+ priv->scan_interval = SCAN_INTERVAL_MIN + SCAN_INTERVAL_STEP;
68+ nm_log_dbg (LOGD_WIFI_SCAN, "(%s): reset scanning interval to %d seconds",
69+ nm_device_get_iface (NM_DEVICE (self)),
70+ priv->scan_interval);
71+
72+@@ -2184,16 +2191,20 @@ supplicant_iface_state_cb (NMSupplicantInterface *iface,
73+
74+ /* Request a scan to get latest results */
75+ if (!priv->requested_scan) {
76+ /* Scan request should have been issued in nm_device_state_changed if
77+ * the device was previously unavailable.
78+ */
79+ cancel_pending_scan (self);
80+ request_wireless_scan (self);
81++ } else {
82++ nm_log_dbg (LOGD_WIFI_SCAN,
83++ "(%s): scan already requested",
84++ nm_device_get_iface (device));
85+ }
86+
87+ if (old_state < NM_SUPPLICANT_INTERFACE_STATE_READY)
88+ nm_device_remove_pending_action (device, "waiting for supplicant", TRUE);
89+ break;
90+ case NM_SUPPLICANT_INTERFACE_STATE_COMPLETED:
91+ remove_supplicant_interface_error_handler (self);
92+ remove_supplicant_timeouts (self);
93+--
94+2.8.0.rc3
95+
96
97=== modified file 'debian/patches/series'
98--- debian/patches/series 2016-03-08 18:43:47 +0000
99+++ debian/patches/series 2016-03-23 10:20:36 +0000
100@@ -77,3 +77,4 @@
101 fix-ofono-plugin-leaks.patch
102 rm-scofono-plugin-dbus.patch
103 wifi-fix-cancel-scan.patch
104+clear-requested-scan-when-supplicant-goes-down.patch

Subscribers

People subscribed via source and target branches