From owner-freebsd-stable@FreeBSD.ORG Sun Nov 30 00:08:04 2014 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1659EE08 for ; Sun, 30 Nov 2014 00:08:04 +0000 (UTC) Received: from mail-pa0-x235.google.com (mail-pa0-x235.google.com [IPv6:2607:f8b0:400e:c03::235]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D6BB58AF for ; Sun, 30 Nov 2014 00:08:03 +0000 (UTC) Received: by mail-pa0-f53.google.com with SMTP id kq14so8625640pab.26 for ; Sat, 29 Nov 2014 16:08:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:in-reply-to:references:mime-version :content-type:content-transfer-encoding; bh=ivgbufDIoRy7XJL9egGIUJyNt5RRQeDU/1/3i3GykXM=; b=GGNWpQUAoc5S3BjJsnVV07c/4rGlqxldCLsenXcHFjokd7Bt5nWIV/tOVuy1Xr1RCO /sDm/wykZKCBzTb48UwLnVTgsDZArnrkTeM5sQzMLFaSBQIYUp745e+hZTzPvT60KHzJ IlqJaPCkPKSKDHcajy1Dl03lnRklg1nDmrigfBPGAqr1JVHH5flkIz3lRjfAHdLuLpOl 6b5WAGz5tFNB5dw5mm4hpD4LCoZJ2c0b8+8y/2l5VqrQLw7jyPoFVQXRvybVaH3QlNnJ GA37yMPa8W6huSL+cocrbqGx8VGbwUMgkt9KvJZB3QOVCAr0OgssFTfGGf8ZQXY63CnD IWvw== X-Received: by 10.70.100.199 with SMTP id fa7mr86891668pdb.114.1417306083501; Sat, 29 Nov 2014 16:08:03 -0800 (PST) Received: from splash.akips.com (CPE-120-146-191-2.static.qld.bigpond.net.au. [120.146.191.2]) by mx.google.com with ESMTPSA id w4sm2863356pdq.28.2014.11.29.16.08.01 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 29 Nov 2014 16:08:02 -0800 (PST) Date: Sun, 30 Nov 2014 10:07:20 +1000 From: Paul Koch To: freebsd-stable@freebsd.org Subject: Re: 10.1 mmap on zfs not updating mtime Message-ID: <20141130100720.5b0bead7@splash.akips.com> In-Reply-To: <20141125142302.1199041c@akips.com> References: <20141125142302.1199041c@akips.com> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.22; amd64-portbld-freebsd10.1) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Nov 2014 00:08:04 -0000 Can probably ignore this. We changed our application so it always calls futimes() on the file descriptor after a fsync() or munmap(). Paul. On Tue, 25 Nov 2014 14:23:02 +1000 Paul Koch wrote: > > Hi, > > we have observed some odd behaviour with the mtime of a mmap'ed file > when it has been updated on a zfs pool. The mtime does not appear to > be updated. Seems to work ok on UFS. > > Test program below... > > On 10.0, the following works ok: > > dd bs=1k if=/dev/zero of=mdata count=1 > ls -lT mdata; /tmp/mmap-mtime mdata; ls -lT mdata > > but on 10.1 the mtime stays at its creation time. > > > > #include > #include > #include > > #include > #include > #include > #include > #include > #include > > > int > main (int argc, char **argv) > { > int fd, > i; > char *data, > *filename; > struct stat s; > > if (argc != 2) > exit (1); > > filename =argv[1]; > > if (stat (filename, &s) != 0) { > fprintf (stderr, "stat: %s\n", strerror (errno)); > exit (1); > } > else if ((fd = open (filename, O_RDWR, 0644)) == -1) { > fprintf (stderr, "open: %s\n", strerror (errno)); > exit (1); > } > else if ((data = mmap (NULL, (size_t) s.st_size, > PROT_READ | PROT_WRITE, > MAP_SHARED, > fd, (off_t) 0)) == MAP_FAILED) { > fprintf (stderr, "mmap: %s\n", strerror (errno)); > exit (1); > } > > for (i = 0; i < s.st_size; i++) { > data[i] = 1; > } > > munmap (data, s.st_size); > close (fd); > > exit (0); > } > > Paul.