Skip to content

inotify: stop active watchers when sync is disabled - #115

Open
manishtwari wants to merge 2 commits into
ibm-openbmc:mainfrom
manishtwari:dev/removeWatcher
Open

inotify: stop active watchers when sync is disabled#115
manishtwari wants to merge 2 commits into
ibm-openbmc:mainfrom
manishtwari:dev/removeWatcher

Conversation

@manishtwari

Copy link
Copy Markdown
Contributor

When sync is disabled, active DataWatcher instances may remain blocked waiting for an inotify event in onDataChange(). This prevents the monitor coroutines from exiting immediately.

Add DataWatcher::stop() to remove the active inotify watch descriptors. Removing a watch generates an IN_IGNORED event, which makes the inotify file descriptor readable and wakes the pending fdio::next() operation.

IN_IGNORED is not treated as a data change, so no sync operation is triggered. Once onDataChange() returns, the monitor loop observes that sync is disabled and exits. The existing scope cleanup then removes the DataWatcher from the active watcher map.

During failover, the passive BMC becomes active without restarting the application. Any watcher created for the previous BMC role may therefore remain active. Stopping the existing watchers ensures that they are removed before sync events are started again for the new BMC role.

Call stop() for all active watchers when the DisableSync property is set.

Comment thread src/data_watcher.cpp
When sync is disabled, active DataWatcher instances may remain
blocked waiting for an inotify event in onDataChange(). This
prevents the monitor coroutines from exiting immediately.

If sync is re-enabled before the old monitor coroutine exits, the
code can still use the existing watcher. The new monitor task can
enter onDataChange() while the old monitor task is already waiting
on the same fdio object. sdbusplus fdio rejects a second pending
await on the same fdio object, so the service terminates with:
```
what(): fdio_completion started with another await already pending!
```
Add DataWatcher::stop() to remove the active inotify watch
descriptors. Removing a watch generates an IN_IGNORED event,
which makes the inotify file descriptor readable and wakes
the pending fdio::next() operation.

IN_IGNORED is not treated as a data change, so no sync
operation is triggered. Once onDataChange() returns, the
monitor loop observes that sync is disabled and exits.
The existing scope cleanup then removes the DataWatcher
from the active watcher map.

During failover, the passive BMC becomes active without
restarting the application. Any watcher created for the previous
BMC role may therefore remain active. Stopping the existing
watchers ensures that they are removed before sync events are
started again for the new BMC role.

Call stop() for all active watchers when the DisableSync
property is set.

Change-Id: I7e21ded548ff56eeaf7885aeafdefc7fd3a3c13c
Signed-off-by: Manish Tiwari <tmanish.in@gmail.com>
…bm-openbmc#110)"

This fix is no longer needed as the root cause is addressed
in the commit c0eeccb.

This reverts commit 79c8879.

Change-Id: I79a55c8dcecac6f1ed05c674546953077a45861b
Signed-off-by: Manish Tiwari <tmanish.in@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants