> So, why do you get a deleted event for /tmp/foo in the first case when the
> directory has something in it, but not the second with the empty directory?
> It would interesting to see what IRIX does with this. I'm guessing the idea
> is to keep the IRIX and Linux versions consistent.
(I just tried it on IRIX, and you *do* get notified when the empty directory
> When vfs_rmdir (in 2.4, do_rmdir in 2.2) is called an IMON_CONTENT event is
> created for the parent directory. This is why nothing happens in the second
> case, '/tmp' is not being monitored so imon doesn't report the event.
Huh. It looks like this is similar to what happens in IRIX (vfs_rmdir does
enqueue an IMON_CONTENT event, but as I'm not much of a kernel guy, I'm not
sure whether it's enqueued for the parent of the deleted directory, or for
the directory itself). If it's for the directory itself, that might explain
why it works; the event is on a monitored inode, so imon passes it to fam,
which sees that it no longer exists, and sends delete events to its clients.
(On the other hand, it seems like that *wouldn't* work in the case where
/tmp/foo/bar is a directory, and you're monitoring /tmp/foo, and rm -r bar;
that does work on IRIX, so I don't know.)
> So, it would seem that the correct thing to do would be to add an
> IMON_DELETE event inside vfs_rmdir for the directory that is being deleted.
> When I tried this out, the first case worked the same, and on the second
> case I got a deleted and changed event on '/tmp/foo' (in that order). If
> there are no objections I'll go ahead and add this to a future patch.
That sounds good to me, especially since it works. (I would be curious to
see whether making vfs_rmdir send the IMON_CHANGED event for the removed
directory instead of its parent would also make fam work correctly, but that
is arguably wrong, and your way isn't.)
> Another question: Is there a document available which has a comprehensive
> list of "when X occurs, imon reports Y" which I haven't stumbled across? It
> would make knowing what to do in this kind of situation much easier.
Yeah, not that I know of.
Source code, list archive, and docs: http://oss.sgi.com/projects/fam/
To unsubscribe: echo unsubscribe fam | mail majordomo@xxxxxxxxxxx