readahead-watch fails silently when it runs out of inotify watches
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
readahead-list (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
Binary package hint: readahead-list
in readahead-watch.c, in watch_directory, the following code block:
/* Add a watch on the directory */
wd = inotify_add_watch (inotify_fd, queue->path,
if (wd < 0) {
}
makes readahead-watch skip a directory and continue on any error when trying to add a watch. This includes ENOSPC, which from the inotify_add_watch man page means:
ENOSPC The user limit on the total number of inotify watches was reached or
the kernel failed to allocate a needed resource.
If readahead-watch gets a ENOSPC, it's pointless to keep trying to add more watches, so it should break out of rather than continue the loop. It should also inform the user that this happened, so that the user is not confused (as I was) when readahead-watch finishes with an empty output file.
Maybe it should do the following instead:
/* Add a watch on the directory */
wd = inotify_add_watch (inotify_fd, queue->path,
if (wd < 0) {
}