[systemd-devel] Using *.path units without races?

Michael Chapman mike at very.puzzling.org
Tue Mar 17 21:52:19 UTC 2020


On Wed, 18 Mar 2020, Uwe Geuder wrote:
> Hi!
> 
> I have wondered for a while how I can use *.path units without (too bad)
> races.
> 
> Since
> https://github.com/systemd/systemd/pull/13509/commits/06582e42de65a61d0238a18720a12b6353edb7cd
> the behaviour has been become much clearer, but I must admit I still
> don't get it.

That commit does look incomplete to me.

As a quick test, are you able to try out the patch below? This makes 
systemd always check the filesystem when the service stops, rather than 
just relying on the (as of that commit nonexistent) inotify event.

(This change would mean the third argument to path_enter_waiting() is 
always true, so the code can be further simplified afterwards. The big 
comment in path_dispatch_io() should probably also be changed.)


diff --git a/src/core/path.c b/src/core/path.c
index cb75d778af..a513df97b2 100644
--- a/src/core/path.c
+++ b/src/core/path.c
@@ -759,11 +759,7 @@ static void path_trigger_notify(Unit *u, Unit *other) 
{
         if (p->state == PATH_RUNNING &&
             UNIT_IS_INACTIVE_OR_FAILED(unit_active_state(other))) {
                 log_unit_debug(UNIT(p), "Got notified about unit deactivation.");
-
-                /* Hmm, so inotify was triggered since the
-                 * last activation, so I guess we need to
-                 * recheck what is going on. */
-                path_enter_waiting(p, false, p->inotify_triggered);
+                path_enter_waiting(p, false, true);
         }
 }


More information about the systemd-devel mailing list