LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 12-11-2011, 04:34 PM   #1
Meson
Member
 
Registered: Oct 2007
Distribution: Arch x86_64
Posts: 606

Rep: Reputation: 67
fanotify howto?: recursive mark, directory changes


First of all, I have been under the impression that fanotify can serve as a complete replacement for inotify (because I believe inotify actually uses fanotify as its backend now). Please correct me if I'm wrong.

I'm having trouble doing two things.

1) Recursively watching an entire tree. Is this possible? Or do I have to start with a directory and manually apply marks to all descendent directories.

2) I'm having trouble seeing file creation/deletion on a directory. For a file creation I see an open/close for the file itself, sometimes grouped in a single event. But I never see it with respect to the directory. So file deletions are aren't noticed at all.

What I'm really after here is being able to see a file move. Is this possible?

Thanks!
 
Old 12-11-2011, 06:02 PM   #2
Nominal Animal
Senior Member
 
Registered: Dec 2010
Location: Finland
Distribution: Xubuntu, CentOS, LFS
Posts: 1,723
Blog Entries: 3

Rep: Reputation: 947Reputation: 947Reputation: 947Reputation: 947Reputation: 947Reputation: 947Reputation: 947Reputation: 947
Quote:
Originally Posted by Meson View Post
First of all, I have been under the impression that fanotify can serve as a complete replacement for inotify (because I believe inotify actually uses fanotify as its backend now). Please correct me if I'm wrong.
Well, not really wrong. Both inotify and fanotify use fsnotify as their backend. fanotify is only available in kernels 2.6.37 and later. They seem to support different feature sets, so I wouldn't say one replaces the other.

Quote:
Originally Posted by Meson View Post
1) Recursively watching an entire tree. Is this possible? Or do I have to start with a directory and manually apply marks to all descendent directories.
You can watch an entire mount point, using FAN_MARK_MOUNT (and add ignore marks to directories you are not interested in).

Quote:
Originally Posted by Meson View Post
So file deletions are aren't noticed at all.
Dammit, you're right. File replacement or deletion is not caught at all, not even using the FAN_OPEN_PERM | FAN_ACCESS_PERM marks (using FAN_CLASS_CONTENT or FAN_CLASS_PRE_CONTENT). Neither is subdirectory creation, renaming, or deletion!

This is definitely unsatisfactory. Fanotify as it is right now is only useful for file scanners. I was hoping to use it to control and monitor access to configuration files (storing changesets and identifying the original user, without user interaction). I would have liked to get synchronous CLOSE_WRITEs (that block the close() until a response is given), but subdirectory and deletion and rename events are absolutely necessary for fanotify to be really useful.

By the way, this is my 999th post
 
Old 12-11-2011, 06:22 PM   #3
Meson
Member
 
Registered: Oct 2007
Distribution: Arch x86_64
Posts: 606

Original Poster
Rep: Reputation: 67
Ah, fsnotify, that's what I was thinking. It'd be nice if fanotify was inotify+blocking =). Oh well, I don't need blocking so I guess inotify is what I want. I'm better off anyway because there's far more information out there about it.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Recursive directory copy benjam1nrk Linux - General 6 11-08-2010 10:50 AM
Recursive directory search janel10 Linux - Newbie 2 08-26-2008 06:28 AM
cmdline: howto know size of folder (recursive) ? Xeratul Linux - General 7 07-18-2007 12:04 PM
deletion of a recursive directory? captainnico Linux - Software 9 02-04-2006 05:52 AM
recursive directory traversal klfreese Linux - Newbie 2 08-20-2003 07:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 03:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration