|
From: | Pádraig Brady |
Subject: | Re: tail + inotify over nfs |
Date: | Tue, 15 Dec 2009 11:56:00 +0000 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.5) Gecko/20091204 Thunderbird/3.0 |
On 13/12/09 13:06, Giuseppe Scrivano wrote:
Hello, Jim Meyering<address@hidden> writes:Pádraig Brady wrote:I've just noticed that `tail -f` will not work over NFS as changes on the remote system will not go through the local VFS and so will not be noticed by inotify. So what to do? I suppose we could statfs("filename")Yes, I think something like that is required. For even less impact, call fstatfs on the file descriptor.When this check should be done? At initialization before enter the tail_forever/tail_forever_inotify loop? In this case, shouldn't we take into account that the underyling FS can be changed when "tail -F" is used? Like: (sleep 5s; mount -F nfs server:/foo/bar /mnt/)& tail -F /mnt/file
I got a few minutes to look at this today, and the attached patch seems to work with a very quick test. It doesn't handle the above remount case though as if I mount the parent dir of a file or bind mount the file itself then there are no inotify notifications. This remounting issue is independent of nfs anyway. So can inotify handle this or will we have to periodically check with a select rather than a blocking read? cheers, Pádraig.
tail-nfs.diff
Description: Text Data
[Prev in Thread] | Current Thread | [Next in Thread] |