3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 13:02:44 +01:00

knownnetworks: Avoid unnecessary known object removal

Due to the quirk in how storage_network_sync implements file writing,
iwd was generating unnecessary KnownNetwork removal events (and
preventing certain test cases from passing successfully)

storage_network_sync tries to perform atomic writes by writing to a
temporary storage location first, unlinking the existing file and
renaming the tmp file as the original.

This generates a set of inotify events which confuses the current
implementation.
This commit is contained in:
Denis Kenzior 2018-08-10 12:13:47 -05:00
parent c38b77d0c0
commit cbc149c7ed

View File

@ -319,19 +319,14 @@ static void known_networks_watch_cb(struct l_fswatch *watch,
switch (event) { switch (event) {
case L_FSWATCH_EVENT_DELETE: case L_FSWATCH_EVENT_DELETE:
if (network_before)
known_network_removed(network_before);
break;
case L_FSWATCH_EVENT_MOVE: case L_FSWATCH_EVENT_MOVE:
case L_FSWATCH_EVENT_MODIFY: case L_FSWATCH_EVENT_MODIFY:
case L_FSWATCH_EVENT_ATTRIB: case L_FSWATCH_EVENT_ATTRIB:
case L_FSWATCH_EVENT_CREATE: case L_FSWATCH_EVENT_CREATE:
/* /*
* Any of the four operations may result in the removal * For now treat all the operations the same. E.g. they may
* of the network (file moved out, not readable or * result in the removal of the network (file moved out, not
* invalid) or the creation of a new network (file * readable or invalid) or the creation of a new network (file
* created, permissions granted, syntax fixed, etc.) * created, permissions granted, syntax fixed, etc.)
* so we always need to re-read the file. * so we always need to re-read the file.
*/ */