On Die, 24 Apr 2001, Daniel Phillips wrote:
> > I have a small problem when using the directory notifications. when the
> > directory itself that I watch in my program is deleted, I don't receive an
> > event, although I'd expect a delete event for the "." entry (IMHO). This
> > makes it much easier to detect this relatively rare case, otherwise one
> > would need to add twice as many watchpoints (for every directory its parent
> > directory as well), which is no good solution in my opinion.
> With your patch you are sending the delete event twice, once to the directory
> being deleted and again to the containing directory (if you have registered
> for events on it). That doesn't sound right to me.
Right. I don't see the problem for that though, instead I consider it the
actually correct behaviour.
a) a program that registered on the parent directory wants the event because
its directory is modified
b) a program that registered on "this" directory wants the event to
recognize that "its" directory got modified: it got deleted. technically,
the modified timestamp of the directory is changed and its contents
has changed ( the "." link disappeared).
Its very simple to distinguish between these two cases (just a stat on the
file name. if it doesn't succeed, it was case b), otherwise a)). Otherwise,
you have to register twice as many event handlers.
> What's really needed here is an "end-of-events" event.
Yes, for compatibility one could add another event type to prevent that an
existing application can't handle the changed behaviour (which should be
rare IMHO). I did decide against this because the code is relatively new and
therefore the legacy-code problem is not that big (IMHO).
> You are also sending the event with the i_zombie semaphore held, which is
> probably not a good idea.
Yes, this way you can detect by a stat() call on if the directory itself got
deleted or not.
I'm not sure if this is "safe" or not. Is it ?
Would a patch that adds another event type be preferred ? should be no big
problem to implement if its safe to emit that event on a "zombie" inode.
Should I come up with a patch for this variant ?
Dirk
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to [EMAIL PROTECTED]