mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: jw schultz <jw@pegasys.ws>
To: linux-kernel@vger.kernel.org
Subject: Re: File change notification
Date: Thu, 1 Jan 2004 02:47:17 -0800	[thread overview]
Message-ID: <20040101104717.GA1373@pegasys.ws> (raw)
In-Reply-To: <3FF2FC85.5070906@lambda-computing.de>

On Wed, Dec 31, 2003 at 05:42:45PM +0100, Rüdiger Klaehn wrote:
> Hi everybody.
> 
> This is my first post to lkml, so please be patient with me
> 
> I have been wondering for some time why there is no decent file change 
> notification mechanism in linux. Is there some deep philosophical reason 
> for this, or is it just that nobody has found the time to implement it? 
> If it is the latter, I am willing to implement it as long there is a 
> chance to get this accepted into the mainstream kernel.
> 
> Is there already somebody working on this problem? I know a few efforts 
> that try to do something similar, but they all work by intercepting 
> every single system call that has to do with files, and they are thus 
> not very fast. See for example
> <http://www.bangstate.com/software.html#changedfiles>
> <http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/openxdsm/openxdsm/eventmodule/> 
> 
> 
> The dnotify mechanism is very limited since it requires a file handle, 
> it is not working for whole directory trees and it does not report much 
> useful information. For example to watch for changes in the /home tree 
> you would have to open every single directory in the tree, which would 
> probably not even work since it would require more than the maximum 
> number of file handles. If you have a directory with many files in it, 
> the only thing dnotify tells you is that something has changed in the 
> directory, so you have to rescan the whole directory to find out which 
> file has changed. Kind of defeats the purpose of change notification...
> 
> What I would like to have would be some way to watch for certain changes 
> anywhere in a whole tree or even the whole file system. This new 
> mechanism should have no measurable performance impact and should log 
> all information that is readily available. The amount of new code in 
> kernel space should be as small as possible. So complicated stuff like 
> pattern matching would have to happen in user space.
> 
> I wrote some experimental mechanism yesterday. Whenever a file is 
> accessed or changed, I write all easily available information to a ring 
> buffer which is presented to user space as a device. The information 
> that is easily available is the inode number of the file or directory 
> that has changed, the inode number of the directory in which the change 
> took place, and in most cases the name of the dentry of the file that 
> has changed.

hmm...


#ln tree1/sub/dir/file tree2/sub/dir/file
#watch_tree tree1 &
#do_something_to tree2/sub/dir/file

A dnotify can potentially know about open, chown, chmod,
utimes and possibly link of the files by watching the paths
and cwd; meaning it won't know about alternate paths.  How
is it to know about read, write, fchown, fchmod and
truncate?

Perhaps someone else has a more fertile imagination but
short of looking up all the file inode numbers of the tree
in question and watching that whole list this sounds futile.

  parent reply	other threads:[~2004-01-01 10:47 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-31 16:42 Rüdiger Klaehn
2003-12-31 18:20 ` Javier Fernandez-Ivern
2003-12-31 18:48   ` Rüdiger Klaehn
2004-01-01  1:28     ` Michael Clark
2004-01-01  1:58       ` Dave Jones
2004-01-01  2:18         ` Michael Clark
2004-01-01  2:30           ` Javier Fernandez-Ivern
2004-01-01 13:11       ` Rüdiger Klaehn
2003-12-31 20:49 ` Javier Fernandez-Ivern
2004-01-01  9:02 ` Juergen Hasch
2004-01-01 10:47 ` jw schultz [this message]
2004-01-01 12:44   ` Rüdiger Klaehn
2004-01-03  6:32     ` Jan Harkes
  -- strict thread matches above, loose matches on Subject: below --
2004-02-07  8:29 John Ogness
2004-02-07 14:01 ` Christoph Hellwig
     [not found] <18PG9-4og-27@gated-at.bofh.it>
     [not found] ` <18TgF-QJ-7@gated-at.bofh.it>
     [not found]   ` <18TJE-1qL-3@gated-at.bofh.it>
2003-12-31 19:30     ` René Scharfe
2002-11-01 21:31 file " Colin Burnett
2002-11-01 22:19 ` Chris Wright
2002-11-02 15:43   ` Jamie Lokier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040101104717.GA1373@pegasys.ws \
    --to=jw@pegasys.ws \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome