Go to file
Gunnar Beutner b00131d43c Fix unlink/xattr deadlock
The problem here is that prune_icache() tries to evict/delete
both the xattr directory inode as well as at least one xattr
inode contained in that directory. Here's what happens:

1. File is created.
2. xattr is created for that file (behind the scenes a xattr
   directory and a file in that xattr directory are created)
3. File is deleted.
4. Both the xattr directory inode and at least one xattr
   inode from that directory are evicted by prune_icache();
   prune_icache() acquires a lock on both inodes before it
   calls ->evict() on the inodes

When the xattr directory inode is evicted zfs_zinactive attempts
to delete the xattr files contained in that directory. While
enumerating these files zfs_zget() is called to obtain a reference
to the xattr file znode - which tries to lock the xattr inode.
However that very same xattr inode was already locked by
prune_icache() further up the call stack, thus leading to a
deadlock.

This can be reliably reproduced like this:
$ touch test
$ attr -s a -V b test
$ rm test
$ echo 3 > /proc/sys/vm/drop_caches

This patch fixes the deadlock by moving the zfs_purgedir() call to
zfs_unlinked_drain().  Instead zfs_rmnode() now checks whether the
xattr dir is empty and leaves the xattr dir in the unlinked set if
it finds any xattrs.

To ensure zfs_unlinked_drain() never accesses a stale super block
zfsvfs_teardown() has been update to block until the iput taskq
has been drained.  This avoids a potential race where a file with
an xattr directory is removed and the file system is immediately
unmounted.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #266
2011-06-20 13:47:03 -07:00
cmd Add "ashift" property to zpool create 2011-06-17 16:35:49 -07:00
config Always check -Wno-unused-but-set-variable gcc support 2011-06-14 16:40:35 -07:00
dracut Autogen refresh. 2011-06-17 13:24:44 -07:00
etc Autogen refresh. 2011-06-17 13:24:44 -07:00
include Add "ashift" property to zpool create 2011-06-17 16:35:49 -07:00
lib Add "ashift" property to zpool create 2011-06-17 16:35:49 -07:00
man Add "ashift" property to zpool create 2011-06-17 16:35:49 -07:00
module Fix unlink/xattr deadlock 2011-06-20 13:47:03 -07:00
patches Add build system 2010-08-31 13:41:27 -07:00
scripts Always check -Wno-unused-but-set-variable gcc support 2011-06-14 16:40:35 -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 Autogen refresh. 2011-06-17 13:24:44 -07:00
configure.ac Fix autoconf variable substitution in udev rules. 2011-06-17 10:11:29 -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 Always check -Wno-unused-but-set-variable gcc support 2011-06-14 16:40:35 -07:00
META Prep zfs-0.6.0-rc4 tag 2011-05-03 10:29:05 -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 Fix 'zfs set volsize=N pool/dataset' 2011-05-02 08:54:40 -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 Update rpm/deb packages to be FHS compliant 2011-06-17 13:36:16 -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