OpenZFS on Linux and FreeBSD
Go to file
Brian Behlendorf 7b3e34ba5a Fix 'zfs rollback' on mounted file systems
Rolling back a mounted filesystem with open file handles and
cached dentries+inodes never worked properly in ZoL.  The
major issue was that Linux provides no easy mechanism for
modules to invalidate the inode cache for a file system.

Because of this it was possible that an inode from the previous
filesystem would not get properly dropped from the cache during
rolling back.  Then a new inode with the same inode number would
be create and collide with the existing cached inode.  Ideally
this would trigger an VERIFY() but in practice the error wasn't
handled and it would just NULL reference.

Luckily, this issue can be resolved by sprucing up the existing
Solaris zfs_rezget() functionality for the Linux VFS.

The way it works now is that when a file system is rolled back
all the cached inodes will be traversed and refetched from disk.
If a version of the cached inode exists on disk the in-core
copy will be updated accordingly.  If there is no match for that
object on disk it will be unhashed from the inode cache and
marked as stale.

This will effectively make the inode unfindable for lookups
allowing the inode number to be immediately recycled.  The inode
will then only be accessible from the cached dentries.  Subsequent
dentry lookups which reference a stale inode will result in the
dentry being invalidated.  Once invalidated the dentry will drop
its reference on the inode allowing it to be safely pruned from
the cache.

Special care is taken for negative dentries since they do not
reference any inode.  These dentires will be invalidate based
on when they were added to the dentry cache.  Entries added
before the last rollback will be invalidate to prevent them
from masking real files in the dataset.

Two nice side effects of this fix are:

* Removes the dependency on spl_invalidate_inodes(), it can now
  be safely removed from the SPL when we choose to do so.

* zfs_znode_alloc() no longer requires a dentry to be passed.
  This effectively reverts this portition of the code to its
  upstream counterpart.  The dentry is not instantiated more
  correctly in the Linux ZPL layer.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ned Bass <bass6@llnl.gov>
Closes #795
2013-01-17 09:51:20 -08:00
cmd Illumos #3397, #3398 2013-01-11 16:42:50 -08:00
config Fix false ENOENT on snapshot control dentries 2013-01-16 16:28:54 -08:00
dracut Remove autotools products 2012-08-27 11:47:44 -07:00
etc vdev_id support for device link aliases 2012-12-03 14:04:47 -08:00
include Fix 'zfs rollback' on mounted file systems 2013-01-17 09:51:20 -08:00
lib Ensure that zfs diff prints unicode safely. 2013-01-16 10:15:57 -08:00
man Illumos #1884, #3028, #3048, #3049, #3060, #3061, #3093 2013-01-11 09:17:19 -08:00
module Fix 'zfs rollback' on mounted file systems 2013-01-17 09:51:20 -08:00
patches Adding grub2 mkconfig support patch 2012-07-30 16:17:23 -07:00
scripts Implemented sharing datasets via SMB using libshare 2012-12-03 09:42:15 -08:00
udev Update 69-vdev.rules .gitignore 2012-12-14 12:16:42 -08:00
.gitignore Remove autotools products 2012-09-11 10:15:13 -07:00
AUTHORS Refresh AUTHORS 2012-12-19 09:47:25 -08: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
META ZFS 0.6.0-rc13 2012-12-20 11:02:24 -08:00
Makefile.am Do not use KERNEL_DIR env var in Makefile.am 2012-12-17 09:45:47 -08:00
OPENSOLARIS.LICENSE Add CDDL license file 2008-12-01 14:49:34 -08:00
PKGBUILD-zfs-modules.in Add make rule for building Arch Linux packages 2011-12-14 19:14:23 -08:00
PKGBUILD-zfs.in Add make rule for building Arch Linux packages 2011-12-14 19:14:23 -08:00
README.markdown Add script for builtin module building. 2012-07-26 13:45:09 -07:00
ZFS.RELEASE Update to onnv_147 2010-08-26 14:24:34 -07:00
autogen.sh Remove autotools products 2012-08-27 11:47:44 -07:00
configure.ac Add /sbin/fsck.zfs helper 2013-01-09 16:54:58 -08:00
copy-builtin Consistent menuconfig name 2012-08-26 13:49:37 -07:00
dkms.conf.in Support building a zfs-modules-dkms sub package 2012-08-08 15:21:01 -07:00
dkms.postinst Support building a zfs-modules-dkms sub package 2012-08-08 15:21:01 -07:00
zfs-modules.spec.in Cleanly remove zfs-modules-devel headers 2012-08-13 16:35:26 -07:00
zfs-script-config.sh.in Unconditionally load core kernel modules 2010-11-11 11:38:25 -08:00
zfs.release.in Move zfs.release generation to configure step 2012-07-12 12:22:51 -07:00
zfs.spec.in Remove the ChangeLog 2012-12-19 09:27:50 -08:00

README.markdown

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

To copy the kernel code inside your kernel source tree for builtin compilation:

$ ./configure --enable-linux-builtin --with-linux=/usr/src/linux-...
$ ./copy-builtin /usr/src/linux-...

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