From owner-freebsd-stable@FreeBSD.ORG Tue Nov 25 04:30:46 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 E0F919AB for ; Tue, 25 Nov 2014 04:30:46 +0000 (UTC) Received: from mail.akips.com (mail.akips.com [65.19.130.19]) by mx1.freebsd.org (Postfix) with ESMTP id CF11A8F5 for ; Tue, 25 Nov 2014 04:30:46 +0000 (UTC) Received: from akips.com (CPE-120-146-191-2.static.qld.bigpond.net.au [120.146.191.2]) by mail.akips.com (Postfix) with ESMTPSA id 20CB827D98 for ; Tue, 25 Nov 2014 14:23:32 +1000 (EST) Date: Tue, 25 Nov 2014 14:23:02 +1000 From: Paul Koch To: freebsd-stable@freebsd.org Subject: 10.1 mmap on zfs not updating mtime Message-ID: <20141125142302.1199041c@akips.com> Organization: AKIPS 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-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY, URIBL_BLOCKED autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on host1.akips.com 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: Tue, 25 Nov 2014 04:30:47 -0000 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. -- Paul Koch | Founder, CEO AKIPS Network Monitor http://www.akips.com Brisbane, Australia