OpenZFS on Linux and FreeBSD
Go to file
Seth Forshee 3f729907c8 Allow mounting datasets more than once
Currently mounting an already mounted zfs dataset results in an
error, whereas it is typically allowed with other filesystems.
This causes some bad interactions with mount namespaces. Take
this sequence for example:

- Create a dataset
- Create a snapshot of the dataset
- Create a clone of the snapshot
- Create a new mount namespace
- Rename the original dataset

The rename results in unmounting and remounting the clone in the
original mount namespace, however the remount fails because the
dataset is still mounted in the new mount namespace. (Note that
this means the mount in the new mount namespace is never being
unmounted, so perhaps the unmount/remount of the clone isn't
actually necessary.)

The problem here is a result of the way mounting is implemented
in the kernel module. Since it is not mounting block devices it
uses mount_nodev() instead of the usual mount_bdev(). However,
mount_nodev() is written for filesystems for which each mount is
a new instance (i.e. a new super block), and zfs should be able
to detect when a mount request can be satisfied using an existing
super block.

Change zpl_mount() to call sget() directly with it's own test
callback. Passing the objset_t object as the fs data allows
checking if a superblock already exists for the dataset, and in
that case we just need to return a new reference for the sb's
root dentry.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tom Caputi <tcaputi@datto.com>
Signed-off-by: Alek Pinchuk <apinchuk@datto.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Closes #5796
Closes #7207
2018-05-07 17:19:57 -07:00
.github Update codecov.yml 2018-03-14 16:10:36 -07:00
cmd Fedora 28: Fix misc bounds check compiler warnings 2018-05-07 17:19:57 -07:00
config Allow mounting datasets more than once 2018-05-07 17:19:57 -07:00
contrib modprobe zfs during dracut mount 2018-05-07 17:19:57 -07:00
etc chmod -x on etc/init.d/zfs-*.in automake files 2018-05-07 17:19:57 -07:00
include Allow mounting datasets more than once 2018-05-07 17:19:57 -07:00
lib Fedora 28: Fix misc bounds check compiler warnings 2018-05-07 17:19:57 -07:00
man Fix 'zfs send/recv' hang with 16M blocks 2018-05-07 17:19:57 -07:00
module Allow mounting datasets more than once 2018-05-07 17:19:57 -07:00
rpm Exclude python scripts from RPM shebang check 2018-05-07 17:19:57 -07:00
scripts Fix free memory calculation on v3.14+ 2018-03-14 16:10:37 -07:00
tests Allow mounting datasets more than once 2018-05-07 17:19:57 -07:00
udev Fix spelling 2017-01-03 11:31:18 -06:00
.gitignore Add configure option to enable gcov analysis 2018-03-14 16:10:36 -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.8 2018-04-09 14:31:57 -07:00
Makefile.am Add support for "--enable-code-coverage" option 2018-03-14 16:10:36 -07:00
OPENSOLARIS.LICENSE Add CDDL license file 2008-12-01 14:49:34 -08:00
README.markdown Update codecov.yml 2018-03-14 16:10:36 -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 Fix mmap / libaio deadlock 2018-05-07 17:19:57 -07: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

img

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

codecov

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.