OpenZFS on Linux and FreeBSD
Go to file
LOLi fedc1d96a8 Fix truncate(2) mtime and ctime handling
On Linux, ftruncate(2) always changes the file timestamps, even if the
file size is not changed. However, in case of a successfull
truncate(2), the timestamps are updated only if the file size changes.
This translates to the VFS calling the ZFS Posix Layer "setattr"
function (zpl_setattr) with ATTR_MTIME and ATTR_CTIME unconditionally
set on the iattr mask only when doing a ftruncate(2), while the
truncate(2) is left to the filesystem implementation to be dealt with.

This behaviour is consistent with POSIX:2004/SUSv3 specifications
where there's no explicit requirement for file size changes to update
the timestamps only for ftruncate(2):

http://pubs.opengroup.org/onlinepubs/009695399/functions/truncate.html
http://pubs.opengroup.org/onlinepubs/009695399/functions/ftruncate.html

This has been later updated in POSIX:2008/SUSv4 where, for both
truncate(2)/ftruncate(2), there's no mention of this size change
requirement:

http://austingroupbugs.net/view.php?id=489
http://pubs.opengroup.org/onlinepubs/9699919799/functions/truncate.html
http://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html

Unfortunately the Linux VFS is still calling into the ZPL without
ATTR_MTIME/ATTR_CTIME set in the truncate(2) case: we fix this by
explicitly updating the timestamps when detecting the ATTR_SIZE bit,
which is always set in do_truncate(), on the iattr mask.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: loli10K <ezomori.nozomu@gmail.com>
Closes #6811
Closes #6819
2017-11-21 13:11:29 -06:00
.github Correct cppcheck errors (#6662) 2017-09-20 12:59:21 -07:00
cmd arcstat: flush stdout / outfile after each line 2017-11-20 16:19:23 -06:00
config Support integration with new QAT products 2017-11-20 16:19:23 -06:00
contrib Initramfs fixes 2017-11-20 16:23:33 -06:00
etc systemd zfs-import.target and documentation 2017-11-20 16:20:08 -06:00
include OpenZFS 7531 - Assign correct flags to prefetched buffers 2017-11-21 13:11:29 -06:00
lib Fix function documentation to correctly mirror code 2017-10-17 16:49:14 -07:00
man systemd zfs-import.target and documentation 2017-11-20 16:20:08 -06:00
module Fix truncate(2) mtime and ctime handling 2017-11-21 13:11:29 -06:00
rpm Fix undefined %{systemd_svcs} in RPM scriptlets 2017-11-20 16:48:26 -06:00
scripts Increase default zloop.sh vdev size 2017-10-17 16:49:08 -07:00
tests Fix truncate(2) mtime and ctime handling 2017-11-21 13:11:29 -06:00
udev Fix spelling 2017-01-03 11:31:18 -06:00
.gitignore Improve gitignore 2017-05-25 10:14:13 -07:00
.gitmodules Add zimport.sh compatibility test script 2014-02-21 12:10:31 -08:00
AUTHORS Add a missing > to AUTHORS 2014-09-02 14:18:53 -07:00
COPYRIGHT Update ZED copyright boilerplate 2015-05-11 15:07:00 -07:00
DISCLAIMER Fix minor typos and update marketing copy. 2013-03-21 12:51:06 -07:00
META Tag zfs-0.7.3 2017-10-18 11:00:26 -07:00
Makefile.am Add DKMS package on Debian-based distributions 2017-10-17 16:49:19 -07:00
OPENSOLARIS.LICENSE Add CDDL license file 2008-12-01 14:49:34 -08:00
README.markdown Add CONTRIBUTING information and templates 2016-12-09 12:48:12 -07:00
TEST Retire filebench testing 2017-06-01 06:24:28 -07:00
autogen.sh build: do not call boilerplate ourself 2013-04-02 10:55:20 -07:00
configure.ac Add zgenhostid utility script 2017-07-25 13:22:03 -04:00
copy-builtin Allow c99 when building ZFS in the kernel tree 2017-03-27 12:31:15 -07:00
zfs-script-config.sh.in zpool iostat/status -c improvements 2017-06-05 10:52:15 -07:00
zfs.release.in Move zfs.release generation to configure step 2012-07-12 12:22:51 -07:00

README.markdown

ZFS is an advanced file system and volume manager which was originally developed for Solaris and is now maintained by the Illumos community.

ZFS on Linux, which is also known as ZoL, is currently feature complete. It includes fully functional and stable SPA, DMU, ZVOL, and ZPL layers. And it's native!

Official Resources

Installation

Full documentation for installing ZoL on your favorite Linux distribution can be found at our site.

Contribute & Develop

We have a separate document with contribution guidelines.