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
1 changed files with 3 additions and 8 deletions

View File

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