{"shas":[["6f0cf71e0d191abb850a45f6d216cb5af158a6dd","79778dbbdd172ad4142b370229409ecedf95bcb5@beutner.name","Removed erroneous zfs_inode_destroy() calls from zfs_rmnode().\n\niput_final() already calls zpl_inode_destroy() -> zfs_inode_destroy()\nfor us after zfs_zinactive(), thus making sure that the inode is\nproperly cleaned up.\n\nThe zfs_inode_destroy() calls in zfs_rmnode() would lead to a\ndouble-free.\n\nFixes #282","Gunnar Beutner"],["b00131d43ca344d4b205a03ab3eb771a060e5087","79778dbbdd172ad4142b370229409ecedf95bcb5@beutner.name","Fix unlink/xattr deadlock\n\nThe problem here is that prune_icache() tries to evict/delete\nboth the xattr directory inode as well as at least one xattr\ninode contained in that directory. Here's what happens:\n\n1. File is created.\n2. xattr is created for that file (behind the scenes a xattr\n   directory and a file in that xattr directory are created)\n3. File is deleted.\n4. Both the xattr directory inode and at least one xattr\n   inode from that directory are evicted by prune_icache();\n   prune_icache() acquires a lock on both inodes before it\n   calls ->evict() on the inodes\n\nWhen the xattr directory inode is evicted zfs_zinactive attempts\nto delete the xattr files contained in that directory. While\nenumerating these files zfs_zget() is called to obtain a reference\nto the xattr file znode - which tries to lock the xattr inode.\nHowever that very same xattr inode was already locked by\nprune_icache() further up the call stack, thus leading to a\ndeadlock.\n\nThis can be reliably reproduced like this:\n$ touch test\n$ attr -s a -V b test\n$ rm test\n$ echo 3 > /proc/sys/vm/drop_caches\n\nThis patch fixes the deadlock by moving the zfs_purgedir() call to\nzfs_unlinked_drain().  Instead zfs_rmnode() now checks whether the\nxattr dir is empty and leaves the xattr dir in the unlinked set if\nit finds any xattrs.\n\nTo ensure zfs_unlinked_drain() never accesses a stale super block\nzfsvfs_teardown() has been update to block until the iput taskq\nhas been drained.  This avoids a potential race where a file with\nan xattr directory is removed and the file system is immediately\nunmounted.\n\nSigned-off-by: Brian Behlendorf <behlendorf1@llnl.gov>\nCloses #266","Gunnar Beutner"]],"ref":"refs/heads/master","size":2,"head":"b00131d43ca344d4b205a03ab3eb771a060e5087","push_id":34566468}