From: Andreas Dilger Subject: Re: utimes ==> flush Date: Wed, 12 Mar 2008 23:33:50 -0600 Message-ID: <20080313053350.GE5851@webber.adilger.int> References: <524f69650803122106h7585945eqbf581e251d45e0b5@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7BIT Cc: linux-fsdevel To: Steve French Return-path: Received: from sca-es-mail-1.Sun.COM ([192.18.43.132]:47463 "EHLO sca-es-mail-1.sun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750807AbYCMFfQ (ORCPT ); Thu, 13 Mar 2008 01:35:16 -0400 Received: from fe-sfbay-10.sun.com ([192.18.43.129]) by sca-es-mail-1.sun.com (8.13.7+Sun/8.12.9) with ESMTP id m2D5ZFRA014256 for ; Wed, 12 Mar 2008 22:35:16 -0700 (PDT) Received: from conversion-daemon.fe-sfbay-10.sun.com by fe-sfbay-10.sun.com (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007)) id <0JXN00I01LZLC900@fe-sfbay-10.sun.com> (original mail from adilger@sun.com) for linux-fsdevel@vger.kernel.org; Wed, 12 Mar 2008 22:35:15 -0700 (PDT) In-reply-to: <524f69650803122106h7585945eqbf581e251d45e0b5@mail.gmail.com> Content-disposition: inline Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Mar 12, 2008 23:06 -0500, Steve French wrote: > Since utimes of a cached file could reset the file time before a write > is sent remotely, do NFS and the Linux cluster file systems simply > turn setattr of any timestamp into a fsync of all cached file data? > (this seems excessive when the file is cacheable/oplocked). Is there > are precedent for caching the write of timestamps when writebehind > file data is cached (otherwise the performance penalty could be > horrible)? Lustre handles this at the server side. The only "reasonable" race to handle is if the same client is doing both the write and the utimes call, since if two clients are doing the operation the order is not deterministic anyways. What happens is that each write is tagged with an RPC XID number at send, as is the setattr RPC, and if a setattr RPC with a lower mtime arrives at the server the setattr XID is cached for some period of time and any write RPC that arrives with a lower XID will have the mtime cleared instead of allowing it to move the mtime forward. This avoids the race (which we hit in some cases) where the write was being sent over the network and is processed slightly after the utimes() call, which was actually done later on the client. A common case for this is tar, which calls utimes() after extracting the data. Any later write RPCs will contain the "more uptodate but lower" mtime from the client inode and will not advance the mtime on the server. This also avoids the need to flush all of the data from the client before sending the setattr. Note that Lustre uses the timestamps of the clients and not those of the servers, to avoid the "NFS server setting file times in the future" issues that confuses make and friends. Cheers, Andreas -- Andreas Dilger Sr. Staff Engineer, Lustre Group Sun Microsystems of Canada, Inc.