Re: mnotify: mixing nonotify & simple mount watching (Was: Re: [RFC/PATCH] Nonotify...)



On Saturday 14 August 2004 00:27, Danny Milosavljevic wrote:
> ...
> Keep in mind that directory mtimes have pretty unexpected semantics. If
> you have a directory "a" which in turn has a directory "b" which in turn
> contains file "c", if you change file "c", for some reason *only* the
> mtime of the directory "b" get updated.
> (I'd either think that it would be *supposed* to be either: 1) *only*
> the mtime of the file be updated or 2) the mtime of the directory "b" be
> updated, that would trigger updating the mtime of the directory "a")
>
> a     <-- 3. mtime, unchanged
> +--b  <-- 2. mtime, changed
>    +-- c <-- 1. file, changed

Yes, but this is not inconsistent.
A directory is more or less only a file with a list of the names of files and 
directories in that directory, and links to the corresponding inodes. Thus, 
changes to a directory are done only if a file name is changed, a file is 
added or removed. In contrast, the mtime of a file is an attribute of the 
inode holding the data of the file, and does not change the directory itself.
Even the file size is an inode attribute, and changing a file size doesn't 
change the mtime of the parent directory. Nonotify is for this.

Besides, a need to change some attributes of an arbitrary number of 
directories in a path up to the root, and that every time a write happens, 
perhaps could be seen as a way for a DoS attack ?

With hardlinks, a file can be a child of many directories. How is this handled 
in nonotify?

Josef




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]