Bug 104660

Summary: inotify: IN_IGNORED is sent although unlinked file is not watched anymore
Product: [openSUSE] SUSE LINUX 10.0 Reporter: Gernot Payer <gpayer>
Component: KernelAssignee: Robert Love <rml>
Status: RESOLVED INVALID QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None    
Version: Beta 1   
Target Milestone: ---   
Hardware: Other   
OS: All   
Whiteboard:
Found By: Other Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Gernot Payer 2005-08-15 11:25:45 UTC
When doing this

wd = inotify_add_watch(fd, "file", IN_ACCESS);
(do stuff with "file")
inotify_rm_watch(fd, wd);
close(file_fd);
unlink("file");

there is still an IN_IGNORED event pending in fd, although "file" is deleted 
after the watch has been removed. I don't think this is the intended behaviour.
Comment 1 Robert Love 2005-08-15 16:20:06 UTC
You will get an IN_IGNORED event when you remove the watch.

So, unless you are seeing TWO such events, this is not a bug.
Comment 2 Gernot Payer 2005-08-16 08:55:00 UTC
I'm sorry, but this behaviour makes absolutely no sense to me. When I remove a 
watch, then I don't want to get any further events about that file/dir.

You might also want to describe this behaviour in the documentation.
Comment 3 Robert Love 2005-08-16 14:34:43 UTC
It is consistent: You get an IN_IGNORED event whenever an event is removed,
regardless of how.

Also, it lets applications handle event removal in a single place, their
IN_IGNORED handler.