Hello; We are working on an application that needs to grab files put onto an ext3 filesystem as soon as they are written. We've looked at lsof, and other tools, and are having troubles finding just the right mechanism to tell when a file has been completely written and the other process has closed the file. In most cases it will be Samba users putting the files onto the ext3 filesystem that we need to process immediatitely, and we will also need to allow NFS users to put files onto the ext3 filesystem. In both cases, we need low-level knowledge of when the file is written completely so we can grab the sucker right away. Any help would be appreciated! John Fraser VisionShare Inc.
Hi, On Sun, Apr 14, 2002 at 08:07:19AM -0500, John Fraser wrote:> > We are working on an application that needs to grab files put onto an ext3 > filesystem as soon as they are written. We've looked at lsof, and other > tools, and are having troubles finding just the right mechanism to tell when > a file has been completely written and the other process has closed the > file.There isn't one, basically.> allow NFS users to put files onto the ext3 filesystem. In both cases, we > need low-level knowledge of when the file is written completely so we can > grab the sucker right away.No such interface exists, but you have the source, you could write one! --Stephen
John Fraser wrote:> > Hello; > > We are working on an application that needs to grab files put onto an ext3 > filesystem as soon as they are written. We've looked at lsof, and other > tools, and are having troubles finding just the right mechanism to tell when > a file has been completely written and the other process has closed the > file. > > In most cases it will be Samba users putting the files onto the ext3 > filesystem that we need to process immediatitely, and we will also need to > allow NFS users to put files onto the ext3 filesystem. In both cases, we > need low-level knowledge of when the file is written completely so we can > grab the sucker right away. >That actually sounds like a fairly useful feature addition for the directory notification code. include/linux/fcntl.h: #define DN_ACCESS 0x00000001 /* File accessed */ #define DN_MODIFY 0x00000002 /* File modified */ #define DN_CREATE 0x00000004 /* File created */ #define DN_DELETE 0x00000008 /* File removed */ #define DN_RENAME 0x00000010 /* File renamed */ #define DN_ATTRIB 0x00000020 /* File changed attibutes */ It would probably be a simple exercise to add "DN_CLOSE", and then run around and implement it. (That being said, what was wrong with polling `lsof' output for the absence of the file?)
On Sun, Apr 14, 2002 at 08:07:19AM -0500, John Fraser wrote:> > In most cases it will be Samba users putting the files onto the ext3 > filesystem that we need to process immediatitely, and we will also need to > allow NFS users to put files onto the ext3 filesystem. In both cases, we > need low-level knowledge of when the file is written completely so we can > grab the sucker right away. >You can hack Samba so that it notifies you when a file has closed; however, in the case of the case of NFS, there is no concept of "file being closed", since NFS is a stateless protocol. The best you could do is "file hasn't been modified for n seconds". - Ted
Seemingly Similar Threads
- 1.0-test51
- brtfs on Solaris? (Re: [osol-discuss] [indiana-discuss] So when are we gonna fork this sucker?)
- Seeking in a saved stream; or,Why isn't that sucker valid?
- Seeking in a saved stream; or, Why isn't that sucker valid?
- Seeking in a saved stream; or, Why isn't that sucker valid?