Skip to content

Commit 11e9d9b

Browse files
rpigottbluca
authored andcommitted
path: drop IN_ATTRIB from parent directory watches
When watching a given pathspec, systemd unconditionally installs IN_ATTRIB watches to track the link count of the resolved file. This way, we are notified if the watched path disappears, even if the resolved file inode is not removed. Similarly, systemd installs inotify watches on each parent directory, to be notified when the specified path appears. However, for these watches IN_ATTRIB is an unnecessary addition to the mask. In inotify, IN_ATTRIB on a directory is emitted whenever the attributes of any child changes, which, for many paths, has the potential to cause a high number of spurious wakeups in systemd. Let's remove IN_ATTRIB from the mask when installing watches on the parent directories of the specified path. (cherry picked from commit 8bf8c7d) (cherry picked from commit fa2b2da) (cherry picked from commit 2818d5a) (cherry picked from commit e9db267) (cherry picked from commit 8f85d9c)
1 parent 5bc4eba commit 11e9d9b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/core/path.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ int path_spec_watch(PathSpec *s, sd_event_io_handler_t handler) {
8181
tmp = *cut;
8282
*cut = '\0';
8383

84-
flags = IN_MOVE_SELF | IN_DELETE_SELF | IN_ATTRIB | IN_CREATE | IN_MOVED_TO;
84+
flags = IN_MOVE_SELF | IN_DELETE_SELF | IN_CREATE | IN_MOVED_TO;
8585
} else {
8686
cut = NULL;
8787
flags = flags_table[s->type];

0 commit comments

Comments
 (0)