Go to file
Brian Behlendorf a140dc5469 Fix mmap(2)/write(2)/read(2) deadlock
When modifing overlapping regions of a file using mmap(2) and
write(2)/read(2) it is possible to deadlock due to a lock inversion.
The zfs_write() and zfs_read() hooks first take the zfs range lock
and then lock the individual pages.  Conversely, when using mmap'ed
I/O the zpl_writepage() hook is called with the individual page
locks already taken and then zfs_putpage() takes the zfs range lock.

The most straight forward fix is to simply not take the zfs range
lock in the mmap(2) case.  The individual pages will still be locked
thus serializing access.  Updating the same region of a file with
write(2) and mmap(2) has always been a dodgy thing to do.  This change
at a minimum ensures we don't deadlock and is consistent with the
existing Linux semantics enforced by the VFS.

This isn't an issue under Solaris because the only range locking
performed will be with the zfs range locks.  It's up to each filesystem
to perform its own file locking.  Under Linux the VFS provides many
of these services.

It may be possible/desirable at a latter date to entirely dump the
existing zfs range locking and rely on the Linux VFS page locks.
However, for now its safest to perform both layers of locking until
zfs is more tightly integrated with the page cache.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #302
2011-07-19 11:55:42 -07:00
cmd Provide a rc.d script for archlinux 2011-07-11 14:12:23 -07:00
config Provide a rc.d script for archlinux 2011-07-11 14:12:23 -07:00
dracut Provide a rc.d script for archlinux 2011-07-11 14:12:23 -07:00
etc Provide a rc.d script for archlinux 2011-07-11 14:12:23 -07:00
include Provide a rc.d script for archlinux 2011-07-11 14:12:23 -07:00
lib Provide a rc.d script for archlinux 2011-07-11 14:12:23 -07:00
man Update 'zpool import' man page 2011-07-19 11:24:20 -07:00
module Fix mmap(2)/write(2)/read(2) deadlock 2011-07-19 11:55:42 -07:00
patches Add build system 2010-08-31 13:41:27 -07:00
scripts Provide a rc.d script for archlinux 2011-07-11 14:12:23 -07:00
.gitignore Ignore unsigned module build products 2010-03-09 14:14:09 -08:00
AUTHORS Add "ashift" property to zpool create 2011-06-17 16:35:49 -07:00
autogen.sh Minor packaging fixes 2010-09-01 15:42:32 -07:00
ChangeLog Add build system 2010-08-31 13:41:27 -07:00
configure Provide a rc.d script for archlinux 2011-07-11 14:12:23 -07:00
configure.ac Implemented sharing datasets via NFS using libshare. 2011-07-06 09:20:28 -07:00
COPYING Relocate COPYING+COPYRIGHT, remove README cruft 2008-12-01 15:34:53 -08:00
COPYRIGHT Update COPYRIGHT to reference zpios CDDL exceptions. 2010-05-18 14:25:28 -07:00
DISCLAIMER Update COPYRIGHT and DISCLAIMER. 2010-05-18 10:32:23 -07:00
Makefile.am Add dracut support 2011-03-17 16:52:04 -07:00
Makefile.in Provide a rc.d script for archlinux 2011-07-11 14:12:23 -07:00
META Prep zfs-0.6.0-rc5 tag 2011-07-01 15:24:34 -07:00
OPENSOLARIS.LICENSE Add CDDL license file 2008-12-01 14:49:34 -08:00
README.markdown Fix markdown rendering 2010-09-15 09:09:37 -07:00
zfs_config.h.in Linux compat 2.6.39: mount_nodev() 2011-07-01 13:36:39 -07:00
zfs-modules.spec.in Fix rebuildable RPMs for el6/ch5 2011-04-08 10:22:42 -07:00
zfs-script-config.sh.in Unconditionally load core kernel modules 2010-11-11 11:38:25 -08:00
ZFS.RELEASE Update to onnv_147 2010-08-26 14:24:34 -07:00
zfs.spec.in Remove zfs service only on uninstall, not on upgrade 2011-07-08 11:44:17 -07:00

Native ZFS for Linux! ZFS is an advanced file system and volume manager which was originally developed for Solaris. It has been successfully ported to FreeBSD and now there is a functional Linux ZFS kernel port too. The port currently includes a fully functional and stable SPA, DMU, and ZVOL with a ZFS Posix Layer (ZPL) on the way!

$ ./configure
$ make pkg

Full documentation for building, configuring, and using ZFS can be found at: http://zfsonlinux.org