From owner-freebsd-hackers@freebsd.org Mon Nov 16 14:00:25 2015 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B1122A30591 for ; Mon, 16 Nov 2015 14:00:25 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 871A41ABD for ; Mon, 16 Nov 2015 14:00:25 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: by mailman.ysv.freebsd.org (Postfix) id 84423A30590; Mon, 16 Nov 2015 14:00:25 +0000 (UTC) Delivered-To: hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6A0A2A3058F for ; Mon, 16 Nov 2015 14:00:25 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from esa-jnhn.mail.uoguelph.ca (esa-jnhn.mail.uoguelph.ca [131.104.91.44]) by mx1.freebsd.org (Postfix) with ESMTP id 20FCB1ABC for ; Mon, 16 Nov 2015 14:00:24 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) IronPort-PHdr: 9a23:dtejxhX78hwWB907IaB1bzwXNdfV8LGtZVwlr6E/grcLSJyIuqrYZhGCt8tkgFKBZ4jH8fUM07OQ6PC9HzFfqsvd+Fk5M7VyFDY9wf0MmAIhBMPXQWbaF9XNKxIAIcJZSVV+9Gu6O0UGUOz3ZlnVv2HgpWVKQka3CwN5K6zPF5LIiIzvjqbpq8CVPloD2Wb1SIgxBSv1hD2ZjtMRj4pmJ/R54TryiVwMRd5rw3h1L0mYhRf265T41pdi9yNNp6BprJYYAu2pN5g/GJBRCjUrNygf/sTttALYBV+D730aQ00diVxIHgrEqhjxGJb15HjUrO14jRObNs6+aLk/WjCv6u8/UhrhgyQDOjsR7WbYl8F0lKIdqxv39E83+JLdfIzAbKk2RajaZ95PHWc= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2DPAQCL4ElW/61jaINeDoQAbwa+WgENgWQXCoUlSgKBchQBAQEBAQEBAYEJgi2CCAEBBAEBASArIAsQAgEIDgoCAg0ZAgIhBgEJJgIECAcEARwEh3gDEg2qKIsoDYRSAQEBAQEBAQMBAQEBAQEBARcEgQGFU4R+glOBaAEBBYMzgUQFjhGIN4UdhSB1g1CTF4Nhg3ACHwEBQoNGXCA0B4QDOoEHAQEB X-IronPort-AV: E=Sophos;i="5.20,303,1444708800"; d="scan'208";a="250642909" Received: from nipigon.cs.uoguelph.ca (HELO zcs1.mail.uoguelph.ca) ([131.104.99.173]) by esa-jnhn.mail.uoguelph.ca with ESMTP; 16 Nov 2015 09:00:10 -0500 Received: from localhost (localhost [127.0.0.1]) by zcs1.mail.uoguelph.ca (Postfix) with ESMTP id 391C115F56D; Mon, 16 Nov 2015 09:00:10 -0500 (EST) Received: from zcs1.mail.uoguelph.ca ([127.0.0.1]) by localhost (zcs1.mail.uoguelph.ca [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 6wv81vn_iDAM; Mon, 16 Nov 2015 09:00:09 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by zcs1.mail.uoguelph.ca (Postfix) with ESMTP id C7B8015F56E; Mon, 16 Nov 2015 09:00:09 -0500 (EST) X-Virus-Scanned: amavisd-new at zcs1.mail.uoguelph.ca Received: from zcs1.mail.uoguelph.ca ([127.0.0.1]) by localhost (zcs1.mail.uoguelph.ca [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 34Gwvo0NMREO; Mon, 16 Nov 2015 09:00:09 -0500 (EST) Received: from zcs1.mail.uoguelph.ca (zcs1.mail.uoguelph.ca [172.17.95.18]) by zcs1.mail.uoguelph.ca (Postfix) with ESMTP id 9A84415F56D; Mon, 16 Nov 2015 09:00:09 -0500 (EST) Date: Mon, 16 Nov 2015 09:00:09 -0500 (EST) From: Rick Macklem To: Daniel Braniss Cc: Konstantin Belousov , hackers@freebsd.org Message-ID: <661673285.88370232.1447682409478.JavaMail.zimbra@uoguelph.ca> In-Reply-To: <3AEC67FD-2E67-4EF9-9D46-818ABF3D8118@cs.huji.ac.il> References: <9BC3EFA2-945F-4C86-89F6-778873B58469@cs.huji.ac.il> <20151115152635.GB5854@kib.kiev.ua> <3AEC67FD-2E67-4EF9-9D46-818ABF3D8118@cs.huji.ac.il> Subject: Re: kqueue of a nfs mounted file not working MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [172.17.95.11] X-Mailer: Zimbra 8.0.9_GA_6191 (ZimbraWebClient - FF34 (Win)/8.0.9_GA_6191) Thread-Topic: kqueue of a nfs mounted file not working Thread-Index: UtLIGiQ9lUEpiyCibLNTP1qc8D2nPQ== X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Nov 2015 14:00:25 -0000 Daniel Braniss wrote: > > > On 15 Nov 2015, at 17:26, Konstantin Belousov wrote: > > > > On Sun, Nov 15, 2015 at 11:22:55AM +0200, Daniel Braniss wrote: > >> HI, > >> I???m writing a program to monitor a file using kqueue(2), if the file is > >> local > >> all is OK, but if the file is via a nfs mounted fs, it only works once. > >> stat shows the file growing, but kevent is not triggered. > > > > Does file grow due to local changes on the nfs client, or some other > > client changes the file, while your client tries to get kevent > > notifications ? > > it gets updated by a host which has the file as local, so yes, it gets > updated > by another client/host. > Hmm, I am not surprised that this doesn't work. The only indication to the client that the file has changed on the server is a change in the file's attributes when they're acquired (via a Getattr RPC or similar) from the server. There is a vfs operation called VFS_SYSCTL(). This isn't implemented on the current NFS client. It was implemented on the old one, but only for NFS locking events and I didn't understand what needed to be done, so I didn't do it. Kostik, do you know if there is a VFS_SYSCTL() call done when the kevent stuff is probing for a file size change? (Or does it not probe and events get triggered via the write syscall or ???) I took a quick look at the kevent stuff, but admit I got lost and couldn't figure out what triggered events being logged? Also, is the event for "file growing" or "file changed"? If it is the latter, all the NFS client can do is look for a change in the file's modify time and this is often at a resolution of 1sec., which implies that a change within the same second as the previous one may not be noticed. (NFSv4 has a Change attribute that is always guaranteed to change, but that is only NFSv4.) Also, you see metadata changes as well as data changes, at least for the NFSv4 attribute. rick > > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" >