Message ID | 20180625193641.23390-1-colin.king@canonical.com |
---|---|
State | New |
Headers | show |
Series | [SRC,XENIAL] UBUNTU: SAUCE: Allow mounting datasets more than once (LP: #1759848) | expand |
On Mon, Jun 25, 2018 at 08:36:41PM +0100, Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > BugLink: https://bugs.launchpad.net/bugs/1759848 > > 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. > > [ Sync'd from zfsutils-linux, from a patch by Seth Forshee and > backported to zfs 0.6.5.6. Note that this also contains > some zfstutils changes between 0.6.5.6-0ubuntu20 and > 0.6.5.6-0ubuntu24 which go also sync'd into this fix, which > is expected part of the zfs sync'ing ] > > Signed-off-by: Colin Ian King <colin.king@canonical.com> Backport looks good. Acked-by: Seth Forshee <seth.forshee@canonical.com>
On 25/06/18 20:36, Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > BugLink: https://bugs.launchpad.net/bugs/1759848 > > 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. > > [ Sync'd from zfsutils-linux, from a patch by Seth Forshee and > backported to zfs 0.6.5.6. Note that this also contains > some zfstutils changes between 0.6.5.6-0ubuntu20 and > 0.6.5.6-0ubuntu24 which go also sync'd into this fix, which > is expected part of the zfs sync'ing ] > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > zfs/META | 2 +- > zfs/Makefile.in | 2 +- > zfs/aclocal.m4 | 2 +- > zfs/config/kernel-fst-mount.m4 | 28 ++++++ > zfs/config/kernel-mount-nodev.m4 | 20 ---- > zfs/config/kernel.m4 | 2 +- > zfs/configure | 150 +++++++++--------------------- > zfs/contrib/Makefile.in | 2 +- > zfs/contrib/bash_completion.d/Makefile.in | 2 +- > zfs/contrib/dracut/90zfs/Makefile.in | 2 +- > zfs/contrib/dracut/Makefile.in | 2 +- > zfs/contrib/initramfs/Makefile.in | 2 +- > zfs/include/Makefile.in | 2 +- > zfs/include/linux/Makefile.in | 2 +- > zfs/include/linux/vfs_compat.h | 24 +++++ > zfs/include/sys/Makefile.in | 2 +- > zfs/include/sys/fm/Makefile.in | 2 +- > zfs/include/sys/fm/fs/Makefile.in | 2 +- > zfs/include/sys/fs/Makefile.in | 2 +- > zfs/module/zfs/zpl_super.c | 65 +++++++++++-- > zfs/zfs_config.h.in | 6 +- > 21 files changed, 175 insertions(+), 148 deletions(-) > create mode 100644 zfs/config/kernel-fst-mount.m4 > delete mode 100644 zfs/config/kernel-mount-nodev.m4 > > diff --git a/zfs/META b/zfs/META > index 6c7026c..6837592 100644 > --- a/zfs/META > +++ b/zfs/META > @@ -2,7 +2,7 @@ Meta: 1 > Name: zfs > Branch: 1.0 > Version: 0.6.5.6 > -Release: 0ubuntu20 > +Release: 0ubuntu24 > Release-Tags: relext > License: CDDL > Author: OpenZFS on Linux > diff --git a/zfs/Makefile.in b/zfs/Makefile.in > index 8f68539..f9b0f69 100644 > --- a/zfs/Makefile.in > +++ b/zfs/Makefile.in > @@ -140,6 +140,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-file-inode.m4 \ > $(top_srcdir)/config/kernel-fmode-t.m4 \ > $(top_srcdir)/config/kernel-follow-down-one.m4 \ > + $(top_srcdir)/config/kernel-fst-mount.m4 \ > $(top_srcdir)/config/kernel-fsync.m4 \ > $(top_srcdir)/config/kernel-generic_io_acct.m4 \ > $(top_srcdir)/config/kernel-get-disk-ro.m4 \ > @@ -155,7 +156,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-lseek-execute.m4 \ > $(top_srcdir)/config/kernel-mk-request-fn.m4 \ > $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ > - $(top_srcdir)/config/kernel-mount-nodev.m4 \ > $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ > $(top_srcdir)/config/kernel-put-link.m4 \ > $(top_srcdir)/config/kernel-security-inode-init.m4 \ > diff --git a/zfs/aclocal.m4 b/zfs/aclocal.m4 > index 391fd54..75a4bfe 100644 > --- a/zfs/aclocal.m4 > +++ b/zfs/aclocal.m4 > @@ -1245,6 +1245,7 @@ m4_include([config/kernel-fallocate.m4]) > m4_include([config/kernel-file-inode.m4]) > m4_include([config/kernel-fmode-t.m4]) > m4_include([config/kernel-follow-down-one.m4]) > +m4_include([config/kernel-fst-mount.m4]) > m4_include([config/kernel-fsync.m4]) > m4_include([config/kernel-generic_io_acct.m4]) > m4_include([config/kernel-get-disk-ro.m4]) > @@ -1260,7 +1261,6 @@ m4_include([config/kernel-lookup-nameidata.m4]) > m4_include([config/kernel-lseek-execute.m4]) > m4_include([config/kernel-mk-request-fn.m4]) > m4_include([config/kernel-mkdir-umode-t.m4]) > -m4_include([config/kernel-mount-nodev.m4]) > m4_include([config/kernel-open-bdev-exclusive.m4]) > m4_include([config/kernel-put-link.m4]) > m4_include([config/kernel-security-inode-init.m4]) > diff --git a/zfs/config/kernel-fst-mount.m4 b/zfs/config/kernel-fst-mount.m4 > new file mode 100644 > index 0000000..a8ac50b > --- /dev/null > +++ b/zfs/config/kernel-fst-mount.m4 > @@ -0,0 +1,28 @@ > +dnl # > +dnl # 2.6.38 API change > +dnl # The .get_sb callback has been replaced by a .mount callback > +dnl # in the file_system_type structure. > +dnl # > +AC_DEFUN([ZFS_AC_KERNEL_FST_MOUNT], [ > + AC_MSG_CHECKING([whether fst->mount() exists]) > + ZFS_LINUX_TRY_COMPILE([ > + #include <linux/fs.h> > + > + static struct dentry * > + mount(struct file_system_type *fs_type, int flags, > + const char *osname, void *data) { > + struct dentry *d = NULL; > + return (d); > + } > + > + static struct file_system_type fst __attribute__ ((unused)) = { > + .mount = mount, > + }; > + ],[ > + ],[ > + AC_MSG_RESULT(yes) > + AC_DEFINE(HAVE_FST_MOUNT, 1, [fst->mount() exists]) > + ],[ > + AC_MSG_RESULT(no) > + ]) > +]) > diff --git a/zfs/config/kernel-mount-nodev.m4 b/zfs/config/kernel-mount-nodev.m4 > deleted file mode 100644 > index 28a4515..0000000 > --- a/zfs/config/kernel-mount-nodev.m4 > +++ /dev/null > @@ -1,20 +0,0 @@ > -dnl # > -dnl # 2.6.39 API change > -dnl # The .get_sb callback has been replaced by a .mount callback > -dnl # in the file_system_type structure. When using the new > -dnl # interface the caller must now use the mount_nodev() helper. > -dnl # This updated callback and helper no longer pass the vfsmount. > -dnl # > -AC_DEFUN([ZFS_AC_KERNEL_MOUNT_NODEV], > - [AC_MSG_CHECKING([whether mount_nodev() is available]) > - ZFS_LINUX_TRY_COMPILE_SYMBOL([ > - #include <linux/fs.h> > - ], [ > - mount_nodev(NULL, 0, NULL, NULL); > - ], [mount_nodev], [fs/super.c], [ > - AC_MSG_RESULT(yes) > - AC_DEFINE(HAVE_MOUNT_NODEV, 1, [mount_nodev() is available]) > - ], [ > - AC_MSG_RESULT(no) > - ]) > -]) > diff --git a/zfs/config/kernel.m4 b/zfs/config/kernel.m4 > index 0eddc2f..0ba5f07d 100644 > --- a/zfs/config/kernel.m4 > +++ b/zfs/config/kernel.m4 > @@ -77,7 +77,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [ > ZFS_AC_KERNEL_TRUNCATE_SETSIZE > ZFS_AC_KERNEL_6ARGS_SECURITY_INODE_INIT_SECURITY > ZFS_AC_KERNEL_CALLBACK_SECURITY_INODE_INIT_SECURITY > - ZFS_AC_KERNEL_MOUNT_NODEV > + ZFS_AC_KERNEL_FST_MOUNT > ZFS_AC_KERNEL_SHRINK > ZFS_AC_KERNEL_SHRINK_CONTROL_HAS_NID > ZFS_AC_KERNEL_S_INSTANCES_LIST_HEAD > diff --git a/zfs/configure b/zfs/configure > index 8d61725..502dec9 100755 > --- a/zfs/configure > +++ b/zfs/configure > @@ -21202,21 +21202,31 @@ fi > > > > - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mount_nodev() is available" >&5 > -$as_echo_n "checking whether mount_nodev() is available... " >&6; } > > + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether fst->mount() exists" >&5 > +$as_echo_n "checking whether fst->mount() exists... " >&6; } > > > cat confdefs.h - <<_ACEOF >conftest.c > > > - #include <linux/fs.h> > + #include <linux/fs.h> > + > + static struct dentry * > + mount(struct file_system_type *fs_type, int flags, > + const char *osname, void *data) { > + struct dentry *d = NULL; > + return (d); > + } > + > + static struct file_system_type fst __attribute__ ((unused)) = { > + .mount = mount, > + }; > > int > main (void) > { > > - mount_nodev(NULL, 0, NULL, NULL); > > ; > return 0; > @@ -21246,64 +21256,25 @@ _ACEOF > ac_status=$? > $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 > test $ac_status = 0; }; }; then : > - rc=0 > -else > - $as_echo "$as_me: failed program was:" >&5 > -sed 's/^/| /' conftest.$ac_ext >&5 > - rc=1 > - > > -fi > - rm -Rf build > - > - > - if test $rc -ne 0; then : > + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 > +$as_echo "yes" >&6; } > > - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 > -$as_echo "no" >&6; } > +$as_echo "#define HAVE_FST_MOUNT 1" >>confdefs.h > > - else > - if test "x$enable_linux_builtin" != xyes; then > > - grep -q -E '[[:space:]]mount_nodev[[:space:]]' \ > - $LINUX_OBJ/$LINUX_SYMBOLS 2>/dev/null > - rc=$? > - if test $rc -ne 0; then > - export=0 > - for file in fs/super.c; do > - grep -q -E "EXPORT_SYMBOL.*(mount_nodev)" \ > - "$LINUX/$file" 2>/dev/null > - rc=$? > - if test $rc -eq 0; then > - export=1 > - break; > - fi > - done > - if test $export -eq 0; then : > - rc=1 > - else : > - rc=0 > - fi > - else : > - rc=0 > - fi > - > - fi > - if test $rc -ne 0; then : > +else > + $as_echo "$as_me: failed program was:" >&5 > +sed 's/^/| /' conftest.$ac_ext >&5 > > - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 > + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 > $as_echo "no" >&6; } > > - else : > > - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 > -$as_echo "yes" >&6; } > - > -$as_echo "#define HAVE_MOUNT_NODEV 1" >>confdefs.h > > +fi > + rm -Rf build > > - fi > - fi > > > > @@ -30596,21 +30567,31 @@ fi > > > > - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mount_nodev() is available" >&5 > -$as_echo_n "checking whether mount_nodev() is available... " >&6; } > > + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether fst->mount() exists" >&5 > +$as_echo_n "checking whether fst->mount() exists... " >&6; } > > > cat confdefs.h - <<_ACEOF >conftest.c > > > - #include <linux/fs.h> > + #include <linux/fs.h> > + > + static struct dentry * > + mount(struct file_system_type *fs_type, int flags, > + const char *osname, void *data) { > + struct dentry *d = NULL; > + return (d); > + } > + > + static struct file_system_type fst __attribute__ ((unused)) = { > + .mount = mount, > + }; > > int > main (void) > { > > - mount_nodev(NULL, 0, NULL, NULL); > > ; > return 0; > @@ -30640,64 +30621,25 @@ _ACEOF > ac_status=$? > $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 > test $ac_status = 0; }; }; then : > - rc=0 > -else > - $as_echo "$as_me: failed program was:" >&5 > -sed 's/^/| /' conftest.$ac_ext >&5 > - rc=1 > - > > -fi > - rm -Rf build > - > - > - if test $rc -ne 0; then : > + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 > +$as_echo "yes" >&6; } > > - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 > -$as_echo "no" >&6; } > +$as_echo "#define HAVE_FST_MOUNT 1" >>confdefs.h > > - else > - if test "x$enable_linux_builtin" != xyes; then > > - grep -q -E '[[:space:]]mount_nodev[[:space:]]' \ > - $LINUX_OBJ/$LINUX_SYMBOLS 2>/dev/null > - rc=$? > - if test $rc -ne 0; then > - export=0 > - for file in fs/super.c; do > - grep -q -E "EXPORT_SYMBOL.*(mount_nodev)" \ > - "$LINUX/$file" 2>/dev/null > - rc=$? > - if test $rc -eq 0; then > - export=1 > - break; > - fi > - done > - if test $export -eq 0; then : > - rc=1 > - else : > - rc=0 > - fi > - else : > - rc=0 > - fi > - > - fi > - if test $rc -ne 0; then : > +else > + $as_echo "$as_me: failed program was:" >&5 > +sed 's/^/| /' conftest.$ac_ext >&5 > > - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 > + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 > $as_echo "no" >&6; } > > - else : > > - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 > -$as_echo "yes" >&6; } > - > -$as_echo "#define HAVE_MOUNT_NODEV 1" >>confdefs.h > > +fi > + rm -Rf build > > - fi > - fi > > > > diff --git a/zfs/contrib/Makefile.in b/zfs/contrib/Makefile.in > index 1ced2ca..c1204cd 100644 > --- a/zfs/contrib/Makefile.in > +++ b/zfs/contrib/Makefile.in > @@ -129,6 +129,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-file-inode.m4 \ > $(top_srcdir)/config/kernel-fmode-t.m4 \ > $(top_srcdir)/config/kernel-follow-down-one.m4 \ > + $(top_srcdir)/config/kernel-fst-mount.m4 \ > $(top_srcdir)/config/kernel-fsync.m4 \ > $(top_srcdir)/config/kernel-generic_io_acct.m4 \ > $(top_srcdir)/config/kernel-get-disk-ro.m4 \ > @@ -144,7 +145,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-lseek-execute.m4 \ > $(top_srcdir)/config/kernel-mk-request-fn.m4 \ > $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ > - $(top_srcdir)/config/kernel-mount-nodev.m4 \ > $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ > $(top_srcdir)/config/kernel-put-link.m4 \ > $(top_srcdir)/config/kernel-security-inode-init.m4 \ > diff --git a/zfs/contrib/bash_completion.d/Makefile.in b/zfs/contrib/bash_completion.d/Makefile.in > index a848010..f29d5cc 100644 > --- a/zfs/contrib/bash_completion.d/Makefile.in > +++ b/zfs/contrib/bash_completion.d/Makefile.in > @@ -130,6 +130,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-file-inode.m4 \ > $(top_srcdir)/config/kernel-fmode-t.m4 \ > $(top_srcdir)/config/kernel-follow-down-one.m4 \ > + $(top_srcdir)/config/kernel-fst-mount.m4 \ > $(top_srcdir)/config/kernel-fsync.m4 \ > $(top_srcdir)/config/kernel-generic_io_acct.m4 \ > $(top_srcdir)/config/kernel-get-disk-ro.m4 \ > @@ -145,7 +146,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-lseek-execute.m4 \ > $(top_srcdir)/config/kernel-mk-request-fn.m4 \ > $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ > - $(top_srcdir)/config/kernel-mount-nodev.m4 \ > $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ > $(top_srcdir)/config/kernel-put-link.m4 \ > $(top_srcdir)/config/kernel-security-inode-init.m4 \ > diff --git a/zfs/contrib/dracut/90zfs/Makefile.in b/zfs/contrib/dracut/90zfs/Makefile.in > index 80f3262..63da6ed 100644 > --- a/zfs/contrib/dracut/90zfs/Makefile.in > +++ b/zfs/contrib/dracut/90zfs/Makefile.in > @@ -130,6 +130,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-file-inode.m4 \ > $(top_srcdir)/config/kernel-fmode-t.m4 \ > $(top_srcdir)/config/kernel-follow-down-one.m4 \ > + $(top_srcdir)/config/kernel-fst-mount.m4 \ > $(top_srcdir)/config/kernel-fsync.m4 \ > $(top_srcdir)/config/kernel-generic_io_acct.m4 \ > $(top_srcdir)/config/kernel-get-disk-ro.m4 \ > @@ -145,7 +146,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-lseek-execute.m4 \ > $(top_srcdir)/config/kernel-mk-request-fn.m4 \ > $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ > - $(top_srcdir)/config/kernel-mount-nodev.m4 \ > $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ > $(top_srcdir)/config/kernel-put-link.m4 \ > $(top_srcdir)/config/kernel-security-inode-init.m4 \ > diff --git a/zfs/contrib/dracut/Makefile.in b/zfs/contrib/dracut/Makefile.in > index 5136e7f..eed070a 100644 > --- a/zfs/contrib/dracut/Makefile.in > +++ b/zfs/contrib/dracut/Makefile.in > @@ -129,6 +129,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-file-inode.m4 \ > $(top_srcdir)/config/kernel-fmode-t.m4 \ > $(top_srcdir)/config/kernel-follow-down-one.m4 \ > + $(top_srcdir)/config/kernel-fst-mount.m4 \ > $(top_srcdir)/config/kernel-fsync.m4 \ > $(top_srcdir)/config/kernel-generic_io_acct.m4 \ > $(top_srcdir)/config/kernel-get-disk-ro.m4 \ > @@ -144,7 +145,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-lseek-execute.m4 \ > $(top_srcdir)/config/kernel-mk-request-fn.m4 \ > $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ > - $(top_srcdir)/config/kernel-mount-nodev.m4 \ > $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ > $(top_srcdir)/config/kernel-put-link.m4 \ > $(top_srcdir)/config/kernel-security-inode-init.m4 \ > diff --git a/zfs/contrib/initramfs/Makefile.in b/zfs/contrib/initramfs/Makefile.in > index 5bf9c44..7a567be 100644 > --- a/zfs/contrib/initramfs/Makefile.in > +++ b/zfs/contrib/initramfs/Makefile.in > @@ -130,6 +130,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-file-inode.m4 \ > $(top_srcdir)/config/kernel-fmode-t.m4 \ > $(top_srcdir)/config/kernel-follow-down-one.m4 \ > + $(top_srcdir)/config/kernel-fst-mount.m4 \ > $(top_srcdir)/config/kernel-fsync.m4 \ > $(top_srcdir)/config/kernel-generic_io_acct.m4 \ > $(top_srcdir)/config/kernel-get-disk-ro.m4 \ > @@ -145,7 +146,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-lseek-execute.m4 \ > $(top_srcdir)/config/kernel-mk-request-fn.m4 \ > $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ > - $(top_srcdir)/config/kernel-mount-nodev.m4 \ > $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ > $(top_srcdir)/config/kernel-put-link.m4 \ > $(top_srcdir)/config/kernel-security-inode-init.m4 \ > diff --git a/zfs/include/Makefile.in b/zfs/include/Makefile.in > index 5dcbe26..be50bca 100644 > --- a/zfs/include/Makefile.in > +++ b/zfs/include/Makefile.in > @@ -130,6 +130,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-file-inode.m4 \ > $(top_srcdir)/config/kernel-fmode-t.m4 \ > $(top_srcdir)/config/kernel-follow-down-one.m4 \ > + $(top_srcdir)/config/kernel-fst-mount.m4 \ > $(top_srcdir)/config/kernel-fsync.m4 \ > $(top_srcdir)/config/kernel-generic_io_acct.m4 \ > $(top_srcdir)/config/kernel-get-disk-ro.m4 \ > @@ -145,7 +146,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-lseek-execute.m4 \ > $(top_srcdir)/config/kernel-mk-request-fn.m4 \ > $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ > - $(top_srcdir)/config/kernel-mount-nodev.m4 \ > $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ > $(top_srcdir)/config/kernel-put-link.m4 \ > $(top_srcdir)/config/kernel-security-inode-init.m4 \ > diff --git a/zfs/include/linux/Makefile.in b/zfs/include/linux/Makefile.in > index 52deade..70974df 100644 > --- a/zfs/include/linux/Makefile.in > +++ b/zfs/include/linux/Makefile.in > @@ -130,6 +130,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-file-inode.m4 \ > $(top_srcdir)/config/kernel-fmode-t.m4 \ > $(top_srcdir)/config/kernel-follow-down-one.m4 \ > + $(top_srcdir)/config/kernel-fst-mount.m4 \ > $(top_srcdir)/config/kernel-fsync.m4 \ > $(top_srcdir)/config/kernel-generic_io_acct.m4 \ > $(top_srcdir)/config/kernel-get-disk-ro.m4 \ > @@ -145,7 +146,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-lseek-execute.m4 \ > $(top_srcdir)/config/kernel-mk-request-fn.m4 \ > $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ > - $(top_srcdir)/config/kernel-mount-nodev.m4 \ > $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ > $(top_srcdir)/config/kernel-put-link.m4 \ > $(top_srcdir)/config/kernel-security-inode-init.m4 \ > diff --git a/zfs/include/linux/vfs_compat.h b/zfs/include/linux/vfs_compat.h > index 8037055..f440f36 100644 > --- a/zfs/include/linux/vfs_compat.h > +++ b/zfs/include/linux/vfs_compat.h > @@ -112,6 +112,30 @@ zpl_bdi_setup_and_register(struct backing_dev_info *bdi, char *name) > #endif > > /* > + * 4.14 adds SB_* flag definitions, define them to MS_* equivalents > + * if not set. > + */ > +#ifndef SB_RDONLY > +#define SB_RDONLY MS_RDONLY > +#endif > + > +#ifndef SB_SILENT > +#define SB_SILENT MS_SILENT > +#endif > + > +#ifndef SB_ACTIVE > +#define SB_ACTIVE MS_ACTIVE > +#endif > + > +#ifndef SB_POSIXACL > +#define SB_POSIXACL MS_POSIXACL > +#endif > + > +#ifndef SB_MANDLOCK > +#define SB_MANDLOCK MS_MANDLOCK > +#endif > + > +/* > * 2.6.38 API change, > * LOOKUP_RCU flag introduced to distinguish rcu-walk from ref-walk cases. > */ > diff --git a/zfs/include/sys/Makefile.in b/zfs/include/sys/Makefile.in > index 20f498f..c0a0c2d 100644 > --- a/zfs/include/sys/Makefile.in > +++ b/zfs/include/sys/Makefile.in > @@ -130,6 +130,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-file-inode.m4 \ > $(top_srcdir)/config/kernel-fmode-t.m4 \ > $(top_srcdir)/config/kernel-follow-down-one.m4 \ > + $(top_srcdir)/config/kernel-fst-mount.m4 \ > $(top_srcdir)/config/kernel-fsync.m4 \ > $(top_srcdir)/config/kernel-generic_io_acct.m4 \ > $(top_srcdir)/config/kernel-get-disk-ro.m4 \ > @@ -145,7 +146,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-lseek-execute.m4 \ > $(top_srcdir)/config/kernel-mk-request-fn.m4 \ > $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ > - $(top_srcdir)/config/kernel-mount-nodev.m4 \ > $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ > $(top_srcdir)/config/kernel-put-link.m4 \ > $(top_srcdir)/config/kernel-security-inode-init.m4 \ > diff --git a/zfs/include/sys/fm/Makefile.in b/zfs/include/sys/fm/Makefile.in > index d8d132f..b6f5397 100644 > --- a/zfs/include/sys/fm/Makefile.in > +++ b/zfs/include/sys/fm/Makefile.in > @@ -130,6 +130,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-file-inode.m4 \ > $(top_srcdir)/config/kernel-fmode-t.m4 \ > $(top_srcdir)/config/kernel-follow-down-one.m4 \ > + $(top_srcdir)/config/kernel-fst-mount.m4 \ > $(top_srcdir)/config/kernel-fsync.m4 \ > $(top_srcdir)/config/kernel-generic_io_acct.m4 \ > $(top_srcdir)/config/kernel-get-disk-ro.m4 \ > @@ -145,7 +146,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-lseek-execute.m4 \ > $(top_srcdir)/config/kernel-mk-request-fn.m4 \ > $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ > - $(top_srcdir)/config/kernel-mount-nodev.m4 \ > $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ > $(top_srcdir)/config/kernel-put-link.m4 \ > $(top_srcdir)/config/kernel-security-inode-init.m4 \ > diff --git a/zfs/include/sys/fm/fs/Makefile.in b/zfs/include/sys/fm/fs/Makefile.in > index 2c61a5e..a1216fb 100644 > --- a/zfs/include/sys/fm/fs/Makefile.in > +++ b/zfs/include/sys/fm/fs/Makefile.in > @@ -130,6 +130,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-file-inode.m4 \ > $(top_srcdir)/config/kernel-fmode-t.m4 \ > $(top_srcdir)/config/kernel-follow-down-one.m4 \ > + $(top_srcdir)/config/kernel-fst-mount.m4 \ > $(top_srcdir)/config/kernel-fsync.m4 \ > $(top_srcdir)/config/kernel-generic_io_acct.m4 \ > $(top_srcdir)/config/kernel-get-disk-ro.m4 \ > @@ -145,7 +146,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-lseek-execute.m4 \ > $(top_srcdir)/config/kernel-mk-request-fn.m4 \ > $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ > - $(top_srcdir)/config/kernel-mount-nodev.m4 \ > $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ > $(top_srcdir)/config/kernel-put-link.m4 \ > $(top_srcdir)/config/kernel-security-inode-init.m4 \ > diff --git a/zfs/include/sys/fs/Makefile.in b/zfs/include/sys/fs/Makefile.in > index 95d7b62..4715b29 100644 > --- a/zfs/include/sys/fs/Makefile.in > +++ b/zfs/include/sys/fs/Makefile.in > @@ -130,6 +130,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-file-inode.m4 \ > $(top_srcdir)/config/kernel-fmode-t.m4 \ > $(top_srcdir)/config/kernel-follow-down-one.m4 \ > + $(top_srcdir)/config/kernel-fst-mount.m4 \ > $(top_srcdir)/config/kernel-fsync.m4 \ > $(top_srcdir)/config/kernel-generic_io_acct.m4 \ > $(top_srcdir)/config/kernel-get-disk-ro.m4 \ > @@ -145,7 +146,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-lseek-execute.m4 \ > $(top_srcdir)/config/kernel-mk-request-fn.m4 \ > $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ > - $(top_srcdir)/config/kernel-mount-nodev.m4 \ > $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ > $(top_srcdir)/config/kernel-put-link.m4 \ > $(top_srcdir)/config/kernel-security-inode-init.m4 \ > diff --git a/zfs/module/zfs/zpl_super.c b/zfs/module/zfs/zpl_super.c > index bcdbbd6..f75a0d8 100644 > --- a/zfs/module/zfs/zpl_super.c > +++ b/zfs/module/zfs/zpl_super.c > @@ -443,12 +443,56 @@ zpl_fill_super(struct super_block *sb, void *data, int silent) > return (error); > } > > -#ifdef HAVE_MOUNT_NODEV > +static int > +zpl_test_super(struct super_block *s, void *data) > +{ > + zfs_sb_t *zsb = s->s_fs_info; > + > + objset_t *os = data; > + > + if (zsb == NULL) > + return (0); > + > + return (os == zsb->z_os); > +} > + > +static struct super_block * > +zpl_mount_impl(struct file_system_type *fs_type, int flags, zfs_mntopts_t *zmo) > +{ > + struct super_block *s; > + objset_t *os; > + int err; > + > + err = dmu_objset_hold(zmo->z_osname, FTAG, &os); > + if (err) > + return (ERR_PTR(-err)); > + > + s = zpl_sget(fs_type, zpl_test_super, set_anon_super, flags, os); > + dmu_objset_rele(os, FTAG); > + if (IS_ERR(s)) > + return (ERR_CAST(s)); > + > + if (s->s_root == NULL) { > + err = zpl_fill_super(s, zmo, flags & SB_SILENT ? 1 : 0); > + if (err) { > + deactivate_locked_super(s); > + return (ERR_PTR(err)); > + } > + s->s_flags |= SB_ACTIVE; > + } else if ((flags ^ s->s_flags) & SB_RDONLY) { > + deactivate_locked_super(s); > + return (ERR_PTR(-EBUSY)); > + } > + > + return (s); > +} > +#ifdef HAVE_FST_MOUNT > static struct dentry * > zpl_mount(struct file_system_type *fs_type, int flags, > const char *osname, void *data) > { > zfs_mntopts_t *zmo = zfs_mntopts_alloc(); > + struct super_block *sb; > int error; > > error = zpl_parse_options((char *)osname, (char *)data, zmo, B_FALSE); > @@ -456,8 +500,11 @@ zpl_mount(struct file_system_type *fs_type, int flags, > zfs_mntopts_free(zmo); > return (ERR_PTR(error)); > } > + sb = zpl_mount_impl(fs_type, flags, zmo); > + if (IS_ERR(sb)) > + return (ERR_CAST(sb)); > > - return (mount_nodev(fs_type, flags, zmo, zpl_fill_super)); > + return (dget(sb->s_root)); > } > #else > static int > @@ -465,6 +512,7 @@ zpl_get_sb(struct file_system_type *fs_type, int flags, > const char *osname, void *data, struct vfsmount *mnt) > { > zfs_mntopts_t *zmo = zfs_mntopts_alloc(); > + struct super_block *sb; > int error; > > error = zpl_parse_options((char *)osname, (char *)data, zmo, B_FALSE); > @@ -472,10 +520,15 @@ zpl_get_sb(struct file_system_type *fs_type, int flags, > zfs_mntopts_free(zmo); > return (error); > } > + sb = zpl_mount_impl(fs_type, flags, zmo); > + if (IS_ERR(sb)) > + return (ERR_CAST(sb)); > + > + (void) simple_set_mnt(mnt, sb); > > - return (get_sb_nodev(fs_type, flags, zmo, zpl_fill_super, mnt)); > + return (0); > } > -#endif /* HAVE_MOUNT_NODEV */ > +#endif /* HAVE_FST_MOUNT */ > > static void > zpl_kill_sb(struct super_block *sb) > @@ -542,10 +595,10 @@ const struct super_operations zpl_super_operations = { > struct file_system_type zpl_fs_type = { > .owner = THIS_MODULE, > .name = ZFS_DRIVER, > -#ifdef HAVE_MOUNT_NODEV > +#ifdef HAVE_FST_MOUNT > .mount = zpl_mount, > #else > .get_sb = zpl_get_sb, > -#endif /* HAVE_MOUNT_NODEV */ > +#endif /* HAVE_FST_MOUNT */ > .kill_sb = zpl_kill_sb, > }; > diff --git a/zfs/zfs_config.h.in b/zfs/zfs_config.h.in > index c5026c8..60cf471 100644 > --- a/zfs/zfs_config.h.in > +++ b/zfs/zfs_config.h.in > @@ -162,6 +162,9 @@ > /* sops->free_cached_objects() exists */ > #undef HAVE_FREE_CACHED_OBJECTS > > +/* fst->mount() exists */ > +#undef HAVE_FST_MOUNT > + > /* fops->fsync() with range */ > #undef HAVE_FSYNC_RANGE > > @@ -252,9 +255,6 @@ > /* Define to 1 if you have the `mlockall' function. */ > #undef HAVE_MLOCKALL > > -/* mount_nodev() is available */ > -#undef HAVE_MOUNT_NODEV > - > /* sops->nr_cached_objects() exists */ > #undef HAVE_NR_CACHED_OBJECTS > > Did this get a 2nd ACK and applied?
Note. Subject should be [PATCH][SRU][XENUAL]... On 26/06/18 14:11, Seth Forshee wrote: > On Mon, Jun 25, 2018 at 08:36:41PM +0100, Colin King wrote: >> From: Colin Ian King <colin.king@canonical.com> >> >> BugLink: https://bugs.launchpad.net/bugs/1759848 >> >> 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. >> >> [ Sync'd from zfsutils-linux, from a patch by Seth Forshee and >> backported to zfs 0.6.5.6. Note that this also contains >> some zfstutils changes between 0.6.5.6-0ubuntu20 and >> 0.6.5.6-0ubuntu24 which go also sync'd into this fix, which >> is expected part of the zfs sync'ing ] >> >> Signed-off-by: Colin Ian King <colin.king@canonical.com> > > Backport looks good. > > Acked-by: Seth Forshee <seth.forshee@canonical.com> >
On 25.06.2018 21:36, Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > BugLink: https://bugs.launchpad.net/bugs/1759848 > > 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. > > [ Sync'd from zfsutils-linux, from a patch by Seth Forshee and > backported to zfs 0.6.5.6. Note that this also contains > some zfstutils changes between 0.6.5.6-0ubuntu20 and > 0.6.5.6-0ubuntu24 which go also sync'd into this fix, which > is expected part of the zfs sync'ing ] > > Signed-off-by: Colin Ian King <colin.king@canonical.com> Acked-by: Stefan Bader <stefan.bader@canonical.com> > --- Had not had a 2nd ack and therefor not, yet applied. But might be now. -Stefan > zfs/META | 2 +- > zfs/Makefile.in | 2 +- > zfs/aclocal.m4 | 2 +- > zfs/config/kernel-fst-mount.m4 | 28 ++++++ > zfs/config/kernel-mount-nodev.m4 | 20 ---- > zfs/config/kernel.m4 | 2 +- > zfs/configure | 150 +++++++++--------------------- > zfs/contrib/Makefile.in | 2 +- > zfs/contrib/bash_completion.d/Makefile.in | 2 +- > zfs/contrib/dracut/90zfs/Makefile.in | 2 +- > zfs/contrib/dracut/Makefile.in | 2 +- > zfs/contrib/initramfs/Makefile.in | 2 +- > zfs/include/Makefile.in | 2 +- > zfs/include/linux/Makefile.in | 2 +- > zfs/include/linux/vfs_compat.h | 24 +++++ > zfs/include/sys/Makefile.in | 2 +- > zfs/include/sys/fm/Makefile.in | 2 +- > zfs/include/sys/fm/fs/Makefile.in | 2 +- > zfs/include/sys/fs/Makefile.in | 2 +- > zfs/module/zfs/zpl_super.c | 65 +++++++++++-- > zfs/zfs_config.h.in | 6 +- > 21 files changed, 175 insertions(+), 148 deletions(-) > create mode 100644 zfs/config/kernel-fst-mount.m4 > delete mode 100644 zfs/config/kernel-mount-nodev.m4 > > diff --git a/zfs/META b/zfs/META > index 6c7026c..6837592 100644 > --- a/zfs/META > +++ b/zfs/META > @@ -2,7 +2,7 @@ Meta: 1 > Name: zfs > Branch: 1.0 > Version: 0.6.5.6 > -Release: 0ubuntu20 > +Release: 0ubuntu24 > Release-Tags: relext > License: CDDL > Author: OpenZFS on Linux > diff --git a/zfs/Makefile.in b/zfs/Makefile.in > index 8f68539..f9b0f69 100644 > --- a/zfs/Makefile.in > +++ b/zfs/Makefile.in > @@ -140,6 +140,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-file-inode.m4 \ > $(top_srcdir)/config/kernel-fmode-t.m4 \ > $(top_srcdir)/config/kernel-follow-down-one.m4 \ > + $(top_srcdir)/config/kernel-fst-mount.m4 \ > $(top_srcdir)/config/kernel-fsync.m4 \ > $(top_srcdir)/config/kernel-generic_io_acct.m4 \ > $(top_srcdir)/config/kernel-get-disk-ro.m4 \ > @@ -155,7 +156,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-lseek-execute.m4 \ > $(top_srcdir)/config/kernel-mk-request-fn.m4 \ > $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ > - $(top_srcdir)/config/kernel-mount-nodev.m4 \ > $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ > $(top_srcdir)/config/kernel-put-link.m4 \ > $(top_srcdir)/config/kernel-security-inode-init.m4 \ > diff --git a/zfs/aclocal.m4 b/zfs/aclocal.m4 > index 391fd54..75a4bfe 100644 > --- a/zfs/aclocal.m4 > +++ b/zfs/aclocal.m4 > @@ -1245,6 +1245,7 @@ m4_include([config/kernel-fallocate.m4]) > m4_include([config/kernel-file-inode.m4]) > m4_include([config/kernel-fmode-t.m4]) > m4_include([config/kernel-follow-down-one.m4]) > +m4_include([config/kernel-fst-mount.m4]) > m4_include([config/kernel-fsync.m4]) > m4_include([config/kernel-generic_io_acct.m4]) > m4_include([config/kernel-get-disk-ro.m4]) > @@ -1260,7 +1261,6 @@ m4_include([config/kernel-lookup-nameidata.m4]) > m4_include([config/kernel-lseek-execute.m4]) > m4_include([config/kernel-mk-request-fn.m4]) > m4_include([config/kernel-mkdir-umode-t.m4]) > -m4_include([config/kernel-mount-nodev.m4]) > m4_include([config/kernel-open-bdev-exclusive.m4]) > m4_include([config/kernel-put-link.m4]) > m4_include([config/kernel-security-inode-init.m4]) > diff --git a/zfs/config/kernel-fst-mount.m4 b/zfs/config/kernel-fst-mount.m4 > new file mode 100644 > index 0000000..a8ac50b > --- /dev/null > +++ b/zfs/config/kernel-fst-mount.m4 > @@ -0,0 +1,28 @@ > +dnl # > +dnl # 2.6.38 API change > +dnl # The .get_sb callback has been replaced by a .mount callback > +dnl # in the file_system_type structure. > +dnl # > +AC_DEFUN([ZFS_AC_KERNEL_FST_MOUNT], [ > + AC_MSG_CHECKING([whether fst->mount() exists]) > + ZFS_LINUX_TRY_COMPILE([ > + #include <linux/fs.h> > + > + static struct dentry * > + mount(struct file_system_type *fs_type, int flags, > + const char *osname, void *data) { > + struct dentry *d = NULL; > + return (d); > + } > + > + static struct file_system_type fst __attribute__ ((unused)) = { > + .mount = mount, > + }; > + ],[ > + ],[ > + AC_MSG_RESULT(yes) > + AC_DEFINE(HAVE_FST_MOUNT, 1, [fst->mount() exists]) > + ],[ > + AC_MSG_RESULT(no) > + ]) > +]) > diff --git a/zfs/config/kernel-mount-nodev.m4 b/zfs/config/kernel-mount-nodev.m4 > deleted file mode 100644 > index 28a4515..0000000 > --- a/zfs/config/kernel-mount-nodev.m4 > +++ /dev/null > @@ -1,20 +0,0 @@ > -dnl # > -dnl # 2.6.39 API change > -dnl # The .get_sb callback has been replaced by a .mount callback > -dnl # in the file_system_type structure. When using the new > -dnl # interface the caller must now use the mount_nodev() helper. > -dnl # This updated callback and helper no longer pass the vfsmount. > -dnl # > -AC_DEFUN([ZFS_AC_KERNEL_MOUNT_NODEV], > - [AC_MSG_CHECKING([whether mount_nodev() is available]) > - ZFS_LINUX_TRY_COMPILE_SYMBOL([ > - #include <linux/fs.h> > - ], [ > - mount_nodev(NULL, 0, NULL, NULL); > - ], [mount_nodev], [fs/super.c], [ > - AC_MSG_RESULT(yes) > - AC_DEFINE(HAVE_MOUNT_NODEV, 1, [mount_nodev() is available]) > - ], [ > - AC_MSG_RESULT(no) > - ]) > -]) > diff --git a/zfs/config/kernel.m4 b/zfs/config/kernel.m4 > index 0eddc2f..0ba5f07d 100644 > --- a/zfs/config/kernel.m4 > +++ b/zfs/config/kernel.m4 > @@ -77,7 +77,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [ > ZFS_AC_KERNEL_TRUNCATE_SETSIZE > ZFS_AC_KERNEL_6ARGS_SECURITY_INODE_INIT_SECURITY > ZFS_AC_KERNEL_CALLBACK_SECURITY_INODE_INIT_SECURITY > - ZFS_AC_KERNEL_MOUNT_NODEV > + ZFS_AC_KERNEL_FST_MOUNT > ZFS_AC_KERNEL_SHRINK > ZFS_AC_KERNEL_SHRINK_CONTROL_HAS_NID > ZFS_AC_KERNEL_S_INSTANCES_LIST_HEAD > diff --git a/zfs/configure b/zfs/configure > index 8d61725..502dec9 100755 > --- a/zfs/configure > +++ b/zfs/configure > @@ -21202,21 +21202,31 @@ fi > > > > - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mount_nodev() is available" >&5 > -$as_echo_n "checking whether mount_nodev() is available... " >&6; } > > + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether fst->mount() exists" >&5 > +$as_echo_n "checking whether fst->mount() exists... " >&6; } > > > cat confdefs.h - <<_ACEOF >conftest.c > > > - #include <linux/fs.h> > + #include <linux/fs.h> > + > + static struct dentry * > + mount(struct file_system_type *fs_type, int flags, > + const char *osname, void *data) { > + struct dentry *d = NULL; > + return (d); > + } > + > + static struct file_system_type fst __attribute__ ((unused)) = { > + .mount = mount, > + }; > > int > main (void) > { > > - mount_nodev(NULL, 0, NULL, NULL); > > ; > return 0; > @@ -21246,64 +21256,25 @@ _ACEOF > ac_status=$? > $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 > test $ac_status = 0; }; }; then : > - rc=0 > -else > - $as_echo "$as_me: failed program was:" >&5 > -sed 's/^/| /' conftest.$ac_ext >&5 > - rc=1 > - > > -fi > - rm -Rf build > - > - > - if test $rc -ne 0; then : > + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 > +$as_echo "yes" >&6; } > > - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 > -$as_echo "no" >&6; } > +$as_echo "#define HAVE_FST_MOUNT 1" >>confdefs.h > > - else > - if test "x$enable_linux_builtin" != xyes; then > > - grep -q -E '[[:space:]]mount_nodev[[:space:]]' \ > - $LINUX_OBJ/$LINUX_SYMBOLS 2>/dev/null > - rc=$? > - if test $rc -ne 0; then > - export=0 > - for file in fs/super.c; do > - grep -q -E "EXPORT_SYMBOL.*(mount_nodev)" \ > - "$LINUX/$file" 2>/dev/null > - rc=$? > - if test $rc -eq 0; then > - export=1 > - break; > - fi > - done > - if test $export -eq 0; then : > - rc=1 > - else : > - rc=0 > - fi > - else : > - rc=0 > - fi > - > - fi > - if test $rc -ne 0; then : > +else > + $as_echo "$as_me: failed program was:" >&5 > +sed 's/^/| /' conftest.$ac_ext >&5 > > - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 > + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 > $as_echo "no" >&6; } > > - else : > > - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 > -$as_echo "yes" >&6; } > - > -$as_echo "#define HAVE_MOUNT_NODEV 1" >>confdefs.h > > +fi > + rm -Rf build > > - fi > - fi > > > > @@ -30596,21 +30567,31 @@ fi > > > > - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mount_nodev() is available" >&5 > -$as_echo_n "checking whether mount_nodev() is available... " >&6; } > > + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether fst->mount() exists" >&5 > +$as_echo_n "checking whether fst->mount() exists... " >&6; } > > > cat confdefs.h - <<_ACEOF >conftest.c > > > - #include <linux/fs.h> > + #include <linux/fs.h> > + > + static struct dentry * > + mount(struct file_system_type *fs_type, int flags, > + const char *osname, void *data) { > + struct dentry *d = NULL; > + return (d); > + } > + > + static struct file_system_type fst __attribute__ ((unused)) = { > + .mount = mount, > + }; > > int > main (void) > { > > - mount_nodev(NULL, 0, NULL, NULL); > > ; > return 0; > @@ -30640,64 +30621,25 @@ _ACEOF > ac_status=$? > $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 > test $ac_status = 0; }; }; then : > - rc=0 > -else > - $as_echo "$as_me: failed program was:" >&5 > -sed 's/^/| /' conftest.$ac_ext >&5 > - rc=1 > - > > -fi > - rm -Rf build > - > - > - if test $rc -ne 0; then : > + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 > +$as_echo "yes" >&6; } > > - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 > -$as_echo "no" >&6; } > +$as_echo "#define HAVE_FST_MOUNT 1" >>confdefs.h > > - else > - if test "x$enable_linux_builtin" != xyes; then > > - grep -q -E '[[:space:]]mount_nodev[[:space:]]' \ > - $LINUX_OBJ/$LINUX_SYMBOLS 2>/dev/null > - rc=$? > - if test $rc -ne 0; then > - export=0 > - for file in fs/super.c; do > - grep -q -E "EXPORT_SYMBOL.*(mount_nodev)" \ > - "$LINUX/$file" 2>/dev/null > - rc=$? > - if test $rc -eq 0; then > - export=1 > - break; > - fi > - done > - if test $export -eq 0; then : > - rc=1 > - else : > - rc=0 > - fi > - else : > - rc=0 > - fi > - > - fi > - if test $rc -ne 0; then : > +else > + $as_echo "$as_me: failed program was:" >&5 > +sed 's/^/| /' conftest.$ac_ext >&5 > > - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 > + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 > $as_echo "no" >&6; } > > - else : > > - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 > -$as_echo "yes" >&6; } > - > -$as_echo "#define HAVE_MOUNT_NODEV 1" >>confdefs.h > > +fi > + rm -Rf build > > - fi > - fi > > > > diff --git a/zfs/contrib/Makefile.in b/zfs/contrib/Makefile.in > index 1ced2ca..c1204cd 100644 > --- a/zfs/contrib/Makefile.in > +++ b/zfs/contrib/Makefile.in > @@ -129,6 +129,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-file-inode.m4 \ > $(top_srcdir)/config/kernel-fmode-t.m4 \ > $(top_srcdir)/config/kernel-follow-down-one.m4 \ > + $(top_srcdir)/config/kernel-fst-mount.m4 \ > $(top_srcdir)/config/kernel-fsync.m4 \ > $(top_srcdir)/config/kernel-generic_io_acct.m4 \ > $(top_srcdir)/config/kernel-get-disk-ro.m4 \ > @@ -144,7 +145,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-lseek-execute.m4 \ > $(top_srcdir)/config/kernel-mk-request-fn.m4 \ > $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ > - $(top_srcdir)/config/kernel-mount-nodev.m4 \ > $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ > $(top_srcdir)/config/kernel-put-link.m4 \ > $(top_srcdir)/config/kernel-security-inode-init.m4 \ > diff --git a/zfs/contrib/bash_completion.d/Makefile.in b/zfs/contrib/bash_completion.d/Makefile.in > index a848010..f29d5cc 100644 > --- a/zfs/contrib/bash_completion.d/Makefile.in > +++ b/zfs/contrib/bash_completion.d/Makefile.in > @@ -130,6 +130,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-file-inode.m4 \ > $(top_srcdir)/config/kernel-fmode-t.m4 \ > $(top_srcdir)/config/kernel-follow-down-one.m4 \ > + $(top_srcdir)/config/kernel-fst-mount.m4 \ > $(top_srcdir)/config/kernel-fsync.m4 \ > $(top_srcdir)/config/kernel-generic_io_acct.m4 \ > $(top_srcdir)/config/kernel-get-disk-ro.m4 \ > @@ -145,7 +146,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-lseek-execute.m4 \ > $(top_srcdir)/config/kernel-mk-request-fn.m4 \ > $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ > - $(top_srcdir)/config/kernel-mount-nodev.m4 \ > $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ > $(top_srcdir)/config/kernel-put-link.m4 \ > $(top_srcdir)/config/kernel-security-inode-init.m4 \ > diff --git a/zfs/contrib/dracut/90zfs/Makefile.in b/zfs/contrib/dracut/90zfs/Makefile.in > index 80f3262..63da6ed 100644 > --- a/zfs/contrib/dracut/90zfs/Makefile.in > +++ b/zfs/contrib/dracut/90zfs/Makefile.in > @@ -130,6 +130,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-file-inode.m4 \ > $(top_srcdir)/config/kernel-fmode-t.m4 \ > $(top_srcdir)/config/kernel-follow-down-one.m4 \ > + $(top_srcdir)/config/kernel-fst-mount.m4 \ > $(top_srcdir)/config/kernel-fsync.m4 \ > $(top_srcdir)/config/kernel-generic_io_acct.m4 \ > $(top_srcdir)/config/kernel-get-disk-ro.m4 \ > @@ -145,7 +146,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-lseek-execute.m4 \ > $(top_srcdir)/config/kernel-mk-request-fn.m4 \ > $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ > - $(top_srcdir)/config/kernel-mount-nodev.m4 \ > $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ > $(top_srcdir)/config/kernel-put-link.m4 \ > $(top_srcdir)/config/kernel-security-inode-init.m4 \ > diff --git a/zfs/contrib/dracut/Makefile.in b/zfs/contrib/dracut/Makefile.in > index 5136e7f..eed070a 100644 > --- a/zfs/contrib/dracut/Makefile.in > +++ b/zfs/contrib/dracut/Makefile.in > @@ -129,6 +129,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-file-inode.m4 \ > $(top_srcdir)/config/kernel-fmode-t.m4 \ > $(top_srcdir)/config/kernel-follow-down-one.m4 \ > + $(top_srcdir)/config/kernel-fst-mount.m4 \ > $(top_srcdir)/config/kernel-fsync.m4 \ > $(top_srcdir)/config/kernel-generic_io_acct.m4 \ > $(top_srcdir)/config/kernel-get-disk-ro.m4 \ > @@ -144,7 +145,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-lseek-execute.m4 \ > $(top_srcdir)/config/kernel-mk-request-fn.m4 \ > $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ > - $(top_srcdir)/config/kernel-mount-nodev.m4 \ > $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ > $(top_srcdir)/config/kernel-put-link.m4 \ > $(top_srcdir)/config/kernel-security-inode-init.m4 \ > diff --git a/zfs/contrib/initramfs/Makefile.in b/zfs/contrib/initramfs/Makefile.in > index 5bf9c44..7a567be 100644 > --- a/zfs/contrib/initramfs/Makefile.in > +++ b/zfs/contrib/initramfs/Makefile.in > @@ -130,6 +130,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-file-inode.m4 \ > $(top_srcdir)/config/kernel-fmode-t.m4 \ > $(top_srcdir)/config/kernel-follow-down-one.m4 \ > + $(top_srcdir)/config/kernel-fst-mount.m4 \ > $(top_srcdir)/config/kernel-fsync.m4 \ > $(top_srcdir)/config/kernel-generic_io_acct.m4 \ > $(top_srcdir)/config/kernel-get-disk-ro.m4 \ > @@ -145,7 +146,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-lseek-execute.m4 \ > $(top_srcdir)/config/kernel-mk-request-fn.m4 \ > $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ > - $(top_srcdir)/config/kernel-mount-nodev.m4 \ > $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ > $(top_srcdir)/config/kernel-put-link.m4 \ > $(top_srcdir)/config/kernel-security-inode-init.m4 \ > diff --git a/zfs/include/Makefile.in b/zfs/include/Makefile.in > index 5dcbe26..be50bca 100644 > --- a/zfs/include/Makefile.in > +++ b/zfs/include/Makefile.in > @@ -130,6 +130,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-file-inode.m4 \ > $(top_srcdir)/config/kernel-fmode-t.m4 \ > $(top_srcdir)/config/kernel-follow-down-one.m4 \ > + $(top_srcdir)/config/kernel-fst-mount.m4 \ > $(top_srcdir)/config/kernel-fsync.m4 \ > $(top_srcdir)/config/kernel-generic_io_acct.m4 \ > $(top_srcdir)/config/kernel-get-disk-ro.m4 \ > @@ -145,7 +146,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-lseek-execute.m4 \ > $(top_srcdir)/config/kernel-mk-request-fn.m4 \ > $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ > - $(top_srcdir)/config/kernel-mount-nodev.m4 \ > $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ > $(top_srcdir)/config/kernel-put-link.m4 \ > $(top_srcdir)/config/kernel-security-inode-init.m4 \ > diff --git a/zfs/include/linux/Makefile.in b/zfs/include/linux/Makefile.in > index 52deade..70974df 100644 > --- a/zfs/include/linux/Makefile.in > +++ b/zfs/include/linux/Makefile.in > @@ -130,6 +130,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-file-inode.m4 \ > $(top_srcdir)/config/kernel-fmode-t.m4 \ > $(top_srcdir)/config/kernel-follow-down-one.m4 \ > + $(top_srcdir)/config/kernel-fst-mount.m4 \ > $(top_srcdir)/config/kernel-fsync.m4 \ > $(top_srcdir)/config/kernel-generic_io_acct.m4 \ > $(top_srcdir)/config/kernel-get-disk-ro.m4 \ > @@ -145,7 +146,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-lseek-execute.m4 \ > $(top_srcdir)/config/kernel-mk-request-fn.m4 \ > $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ > - $(top_srcdir)/config/kernel-mount-nodev.m4 \ > $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ > $(top_srcdir)/config/kernel-put-link.m4 \ > $(top_srcdir)/config/kernel-security-inode-init.m4 \ > diff --git a/zfs/include/linux/vfs_compat.h b/zfs/include/linux/vfs_compat.h > index 8037055..f440f36 100644 > --- a/zfs/include/linux/vfs_compat.h > +++ b/zfs/include/linux/vfs_compat.h > @@ -112,6 +112,30 @@ zpl_bdi_setup_and_register(struct backing_dev_info *bdi, char *name) > #endif > > /* > + * 4.14 adds SB_* flag definitions, define them to MS_* equivalents > + * if not set. > + */ > +#ifndef SB_RDONLY > +#define SB_RDONLY MS_RDONLY > +#endif > + > +#ifndef SB_SILENT > +#define SB_SILENT MS_SILENT > +#endif > + > +#ifndef SB_ACTIVE > +#define SB_ACTIVE MS_ACTIVE > +#endif > + > +#ifndef SB_POSIXACL > +#define SB_POSIXACL MS_POSIXACL > +#endif > + > +#ifndef SB_MANDLOCK > +#define SB_MANDLOCK MS_MANDLOCK > +#endif > + > +/* > * 2.6.38 API change, > * LOOKUP_RCU flag introduced to distinguish rcu-walk from ref-walk cases. > */ > diff --git a/zfs/include/sys/Makefile.in b/zfs/include/sys/Makefile.in > index 20f498f..c0a0c2d 100644 > --- a/zfs/include/sys/Makefile.in > +++ b/zfs/include/sys/Makefile.in > @@ -130,6 +130,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-file-inode.m4 \ > $(top_srcdir)/config/kernel-fmode-t.m4 \ > $(top_srcdir)/config/kernel-follow-down-one.m4 \ > + $(top_srcdir)/config/kernel-fst-mount.m4 \ > $(top_srcdir)/config/kernel-fsync.m4 \ > $(top_srcdir)/config/kernel-generic_io_acct.m4 \ > $(top_srcdir)/config/kernel-get-disk-ro.m4 \ > @@ -145,7 +146,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-lseek-execute.m4 \ > $(top_srcdir)/config/kernel-mk-request-fn.m4 \ > $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ > - $(top_srcdir)/config/kernel-mount-nodev.m4 \ > $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ > $(top_srcdir)/config/kernel-put-link.m4 \ > $(top_srcdir)/config/kernel-security-inode-init.m4 \ > diff --git a/zfs/include/sys/fm/Makefile.in b/zfs/include/sys/fm/Makefile.in > index d8d132f..b6f5397 100644 > --- a/zfs/include/sys/fm/Makefile.in > +++ b/zfs/include/sys/fm/Makefile.in > @@ -130,6 +130,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-file-inode.m4 \ > $(top_srcdir)/config/kernel-fmode-t.m4 \ > $(top_srcdir)/config/kernel-follow-down-one.m4 \ > + $(top_srcdir)/config/kernel-fst-mount.m4 \ > $(top_srcdir)/config/kernel-fsync.m4 \ > $(top_srcdir)/config/kernel-generic_io_acct.m4 \ > $(top_srcdir)/config/kernel-get-disk-ro.m4 \ > @@ -145,7 +146,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-lseek-execute.m4 \ > $(top_srcdir)/config/kernel-mk-request-fn.m4 \ > $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ > - $(top_srcdir)/config/kernel-mount-nodev.m4 \ > $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ > $(top_srcdir)/config/kernel-put-link.m4 \ > $(top_srcdir)/config/kernel-security-inode-init.m4 \ > diff --git a/zfs/include/sys/fm/fs/Makefile.in b/zfs/include/sys/fm/fs/Makefile.in > index 2c61a5e..a1216fb 100644 > --- a/zfs/include/sys/fm/fs/Makefile.in > +++ b/zfs/include/sys/fm/fs/Makefile.in > @@ -130,6 +130,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-file-inode.m4 \ > $(top_srcdir)/config/kernel-fmode-t.m4 \ > $(top_srcdir)/config/kernel-follow-down-one.m4 \ > + $(top_srcdir)/config/kernel-fst-mount.m4 \ > $(top_srcdir)/config/kernel-fsync.m4 \ > $(top_srcdir)/config/kernel-generic_io_acct.m4 \ > $(top_srcdir)/config/kernel-get-disk-ro.m4 \ > @@ -145,7 +146,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-lseek-execute.m4 \ > $(top_srcdir)/config/kernel-mk-request-fn.m4 \ > $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ > - $(top_srcdir)/config/kernel-mount-nodev.m4 \ > $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ > $(top_srcdir)/config/kernel-put-link.m4 \ > $(top_srcdir)/config/kernel-security-inode-init.m4 \ > diff --git a/zfs/include/sys/fs/Makefile.in b/zfs/include/sys/fs/Makefile.in > index 95d7b62..4715b29 100644 > --- a/zfs/include/sys/fs/Makefile.in > +++ b/zfs/include/sys/fs/Makefile.in > @@ -130,6 +130,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-file-inode.m4 \ > $(top_srcdir)/config/kernel-fmode-t.m4 \ > $(top_srcdir)/config/kernel-follow-down-one.m4 \ > + $(top_srcdir)/config/kernel-fst-mount.m4 \ > $(top_srcdir)/config/kernel-fsync.m4 \ > $(top_srcdir)/config/kernel-generic_io_acct.m4 \ > $(top_srcdir)/config/kernel-get-disk-ro.m4 \ > @@ -145,7 +146,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-lseek-execute.m4 \ > $(top_srcdir)/config/kernel-mk-request-fn.m4 \ > $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ > - $(top_srcdir)/config/kernel-mount-nodev.m4 \ > $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ > $(top_srcdir)/config/kernel-put-link.m4 \ > $(top_srcdir)/config/kernel-security-inode-init.m4 \ > diff --git a/zfs/module/zfs/zpl_super.c b/zfs/module/zfs/zpl_super.c > index bcdbbd6..f75a0d8 100644 > --- a/zfs/module/zfs/zpl_super.c > +++ b/zfs/module/zfs/zpl_super.c > @@ -443,12 +443,56 @@ zpl_fill_super(struct super_block *sb, void *data, int silent) > return (error); > } > > -#ifdef HAVE_MOUNT_NODEV > +static int > +zpl_test_super(struct super_block *s, void *data) > +{ > + zfs_sb_t *zsb = s->s_fs_info; > + > + objset_t *os = data; > + > + if (zsb == NULL) > + return (0); > + > + return (os == zsb->z_os); > +} > + > +static struct super_block * > +zpl_mount_impl(struct file_system_type *fs_type, int flags, zfs_mntopts_t *zmo) > +{ > + struct super_block *s; > + objset_t *os; > + int err; > + > + err = dmu_objset_hold(zmo->z_osname, FTAG, &os); > + if (err) > + return (ERR_PTR(-err)); > + > + s = zpl_sget(fs_type, zpl_test_super, set_anon_super, flags, os); > + dmu_objset_rele(os, FTAG); > + if (IS_ERR(s)) > + return (ERR_CAST(s)); > + > + if (s->s_root == NULL) { > + err = zpl_fill_super(s, zmo, flags & SB_SILENT ? 1 : 0); > + if (err) { > + deactivate_locked_super(s); > + return (ERR_PTR(err)); > + } > + s->s_flags |= SB_ACTIVE; > + } else if ((flags ^ s->s_flags) & SB_RDONLY) { > + deactivate_locked_super(s); > + return (ERR_PTR(-EBUSY)); > + } > + > + return (s); > +} > +#ifdef HAVE_FST_MOUNT > static struct dentry * > zpl_mount(struct file_system_type *fs_type, int flags, > const char *osname, void *data) > { > zfs_mntopts_t *zmo = zfs_mntopts_alloc(); > + struct super_block *sb; > int error; > > error = zpl_parse_options((char *)osname, (char *)data, zmo, B_FALSE); > @@ -456,8 +500,11 @@ zpl_mount(struct file_system_type *fs_type, int flags, > zfs_mntopts_free(zmo); > return (ERR_PTR(error)); > } > + sb = zpl_mount_impl(fs_type, flags, zmo); > + if (IS_ERR(sb)) > + return (ERR_CAST(sb)); > > - return (mount_nodev(fs_type, flags, zmo, zpl_fill_super)); > + return (dget(sb->s_root)); > } > #else > static int > @@ -465,6 +512,7 @@ zpl_get_sb(struct file_system_type *fs_type, int flags, > const char *osname, void *data, struct vfsmount *mnt) > { > zfs_mntopts_t *zmo = zfs_mntopts_alloc(); > + struct super_block *sb; > int error; > > error = zpl_parse_options((char *)osname, (char *)data, zmo, B_FALSE); > @@ -472,10 +520,15 @@ zpl_get_sb(struct file_system_type *fs_type, int flags, > zfs_mntopts_free(zmo); > return (error); > } > + sb = zpl_mount_impl(fs_type, flags, zmo); > + if (IS_ERR(sb)) > + return (ERR_CAST(sb)); > + > + (void) simple_set_mnt(mnt, sb); > > - return (get_sb_nodev(fs_type, flags, zmo, zpl_fill_super, mnt)); > + return (0); > } > -#endif /* HAVE_MOUNT_NODEV */ > +#endif /* HAVE_FST_MOUNT */ > > static void > zpl_kill_sb(struct super_block *sb) > @@ -542,10 +595,10 @@ const struct super_operations zpl_super_operations = { > struct file_system_type zpl_fs_type = { > .owner = THIS_MODULE, > .name = ZFS_DRIVER, > -#ifdef HAVE_MOUNT_NODEV > +#ifdef HAVE_FST_MOUNT > .mount = zpl_mount, > #else > .get_sb = zpl_get_sb, > -#endif /* HAVE_MOUNT_NODEV */ > +#endif /* HAVE_FST_MOUNT */ > .kill_sb = zpl_kill_sb, > }; > diff --git a/zfs/zfs_config.h.in b/zfs/zfs_config.h.in > index c5026c8..60cf471 100644 > --- a/zfs/zfs_config.h.in > +++ b/zfs/zfs_config.h.in > @@ -162,6 +162,9 @@ > /* sops->free_cached_objects() exists */ > #undef HAVE_FREE_CACHED_OBJECTS > > +/* fst->mount() exists */ > +#undef HAVE_FST_MOUNT > + > /* fops->fsync() with range */ > #undef HAVE_FSYNC_RANGE > > @@ -252,9 +255,6 @@ > /* Define to 1 if you have the `mlockall' function. */ > #undef HAVE_MLOCKALL > > -/* mount_nodev() is available */ > -#undef HAVE_MOUNT_NODEV > - > /* sops->nr_cached_objects() exists */ > #undef HAVE_NR_CACHED_OBJECTS > >
On 06/25/18 21:36, Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > BugLink: https://bugs.launchpad.net/bugs/1759848 > > 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. > > [ Sync'd from zfsutils-linux, from a patch by Seth Forshee and > backported to zfs 0.6.5.6. Note that this also contains > some zfstutils changes between 0.6.5.6-0ubuntu20 and > 0.6.5.6-0ubuntu24 which go also sync'd into this fix, which > is expected part of the zfs sync'ing ] > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > zfs/META | 2 +- > zfs/Makefile.in | 2 +- > zfs/aclocal.m4 | 2 +- > zfs/config/kernel-fst-mount.m4 | 28 ++++++ > zfs/config/kernel-mount-nodev.m4 | 20 ---- > zfs/config/kernel.m4 | 2 +- > zfs/configure | 150 +++++++++--------------------- > zfs/contrib/Makefile.in | 2 +- > zfs/contrib/bash_completion.d/Makefile.in | 2 +- > zfs/contrib/dracut/90zfs/Makefile.in | 2 +- > zfs/contrib/dracut/Makefile.in | 2 +- > zfs/contrib/initramfs/Makefile.in | 2 +- > zfs/include/Makefile.in | 2 +- > zfs/include/linux/Makefile.in | 2 +- > zfs/include/linux/vfs_compat.h | 24 +++++ > zfs/include/sys/Makefile.in | 2 +- > zfs/include/sys/fm/Makefile.in | 2 +- > zfs/include/sys/fm/fs/Makefile.in | 2 +- > zfs/include/sys/fs/Makefile.in | 2 +- > zfs/module/zfs/zpl_super.c | 65 +++++++++++-- > zfs/zfs_config.h.in | 6 +- > 21 files changed, 175 insertions(+), 148 deletions(-) > create mode 100644 zfs/config/kernel-fst-mount.m4 > delete mode 100644 zfs/config/kernel-mount-nodev.m4 > > diff --git a/zfs/META b/zfs/META > index 6c7026c..6837592 100644 > --- a/zfs/META > +++ b/zfs/META > @@ -2,7 +2,7 @@ Meta: 1 > Name: zfs > Branch: 1.0 > Version: 0.6.5.6 > -Release: 0ubuntu20 > +Release: 0ubuntu24 > Release-Tags: relext > License: CDDL > Author: OpenZFS on Linux > diff --git a/zfs/Makefile.in b/zfs/Makefile.in > index 8f68539..f9b0f69 100644 > --- a/zfs/Makefile.in > +++ b/zfs/Makefile.in > @@ -140,6 +140,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-file-inode.m4 \ > $(top_srcdir)/config/kernel-fmode-t.m4 \ > $(top_srcdir)/config/kernel-follow-down-one.m4 \ > + $(top_srcdir)/config/kernel-fst-mount.m4 \ > $(top_srcdir)/config/kernel-fsync.m4 \ > $(top_srcdir)/config/kernel-generic_io_acct.m4 \ > $(top_srcdir)/config/kernel-get-disk-ro.m4 \ > @@ -155,7 +156,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-lseek-execute.m4 \ > $(top_srcdir)/config/kernel-mk-request-fn.m4 \ > $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ > - $(top_srcdir)/config/kernel-mount-nodev.m4 \ > $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ > $(top_srcdir)/config/kernel-put-link.m4 \ > $(top_srcdir)/config/kernel-security-inode-init.m4 \ > diff --git a/zfs/aclocal.m4 b/zfs/aclocal.m4 > index 391fd54..75a4bfe 100644 > --- a/zfs/aclocal.m4 > +++ b/zfs/aclocal.m4 > @@ -1245,6 +1245,7 @@ m4_include([config/kernel-fallocate.m4]) > m4_include([config/kernel-file-inode.m4]) > m4_include([config/kernel-fmode-t.m4]) > m4_include([config/kernel-follow-down-one.m4]) > +m4_include([config/kernel-fst-mount.m4]) > m4_include([config/kernel-fsync.m4]) > m4_include([config/kernel-generic_io_acct.m4]) > m4_include([config/kernel-get-disk-ro.m4]) > @@ -1260,7 +1261,6 @@ m4_include([config/kernel-lookup-nameidata.m4]) > m4_include([config/kernel-lseek-execute.m4]) > m4_include([config/kernel-mk-request-fn.m4]) > m4_include([config/kernel-mkdir-umode-t.m4]) > -m4_include([config/kernel-mount-nodev.m4]) > m4_include([config/kernel-open-bdev-exclusive.m4]) > m4_include([config/kernel-put-link.m4]) > m4_include([config/kernel-security-inode-init.m4]) > diff --git a/zfs/config/kernel-fst-mount.m4 b/zfs/config/kernel-fst-mount.m4 > new file mode 100644 > index 0000000..a8ac50b > --- /dev/null > +++ b/zfs/config/kernel-fst-mount.m4 > @@ -0,0 +1,28 @@ > +dnl # > +dnl # 2.6.38 API change > +dnl # The .get_sb callback has been replaced by a .mount callback > +dnl # in the file_system_type structure. > +dnl # > +AC_DEFUN([ZFS_AC_KERNEL_FST_MOUNT], [ > + AC_MSG_CHECKING([whether fst->mount() exists]) > + ZFS_LINUX_TRY_COMPILE([ > + #include <linux/fs.h> > + > + static struct dentry * > + mount(struct file_system_type *fs_type, int flags, > + const char *osname, void *data) { > + struct dentry *d = NULL; > + return (d); > + } > + > + static struct file_system_type fst __attribute__ ((unused)) = { > + .mount = mount, > + }; > + ],[ > + ],[ > + AC_MSG_RESULT(yes) > + AC_DEFINE(HAVE_FST_MOUNT, 1, [fst->mount() exists]) > + ],[ > + AC_MSG_RESULT(no) > + ]) > +]) > diff --git a/zfs/config/kernel-mount-nodev.m4 b/zfs/config/kernel-mount-nodev.m4 > deleted file mode 100644 > index 28a4515..0000000 > --- a/zfs/config/kernel-mount-nodev.m4 > +++ /dev/null > @@ -1,20 +0,0 @@ > -dnl # > -dnl # 2.6.39 API change > -dnl # The .get_sb callback has been replaced by a .mount callback > -dnl # in the file_system_type structure. When using the new > -dnl # interface the caller must now use the mount_nodev() helper. > -dnl # This updated callback and helper no longer pass the vfsmount. > -dnl # > -AC_DEFUN([ZFS_AC_KERNEL_MOUNT_NODEV], > - [AC_MSG_CHECKING([whether mount_nodev() is available]) > - ZFS_LINUX_TRY_COMPILE_SYMBOL([ > - #include <linux/fs.h> > - ], [ > - mount_nodev(NULL, 0, NULL, NULL); > - ], [mount_nodev], [fs/super.c], [ > - AC_MSG_RESULT(yes) > - AC_DEFINE(HAVE_MOUNT_NODEV, 1, [mount_nodev() is available]) > - ], [ > - AC_MSG_RESULT(no) > - ]) > -]) > diff --git a/zfs/config/kernel.m4 b/zfs/config/kernel.m4 > index 0eddc2f..0ba5f07d 100644 > --- a/zfs/config/kernel.m4 > +++ b/zfs/config/kernel.m4 > @@ -77,7 +77,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [ > ZFS_AC_KERNEL_TRUNCATE_SETSIZE > ZFS_AC_KERNEL_6ARGS_SECURITY_INODE_INIT_SECURITY > ZFS_AC_KERNEL_CALLBACK_SECURITY_INODE_INIT_SECURITY > - ZFS_AC_KERNEL_MOUNT_NODEV > + ZFS_AC_KERNEL_FST_MOUNT > ZFS_AC_KERNEL_SHRINK > ZFS_AC_KERNEL_SHRINK_CONTROL_HAS_NID > ZFS_AC_KERNEL_S_INSTANCES_LIST_HEAD > diff --git a/zfs/configure b/zfs/configure > index 8d61725..502dec9 100755 > --- a/zfs/configure > +++ b/zfs/configure > @@ -21202,21 +21202,31 @@ fi > > > > - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mount_nodev() is available" >&5 > -$as_echo_n "checking whether mount_nodev() is available... " >&6; } > > + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether fst->mount() exists" >&5 > +$as_echo_n "checking whether fst->mount() exists... " >&6; } > > > cat confdefs.h - <<_ACEOF >conftest.c > > > - #include <linux/fs.h> > + #include <linux/fs.h> > + > + static struct dentry * > + mount(struct file_system_type *fs_type, int flags, > + const char *osname, void *data) { > + struct dentry *d = NULL; > + return (d); > + } > + > + static struct file_system_type fst __attribute__ ((unused)) = { > + .mount = mount, > + }; > > int > main (void) > { > > - mount_nodev(NULL, 0, NULL, NULL); > > ; > return 0; > @@ -21246,64 +21256,25 @@ _ACEOF > ac_status=$? > $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 > test $ac_status = 0; }; }; then : > - rc=0 > -else > - $as_echo "$as_me: failed program was:" >&5 > -sed 's/^/| /' conftest.$ac_ext >&5 > - rc=1 > - > > -fi > - rm -Rf build > - > - > - if test $rc -ne 0; then : > + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 > +$as_echo "yes" >&6; } > > - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 > -$as_echo "no" >&6; } > +$as_echo "#define HAVE_FST_MOUNT 1" >>confdefs.h > > - else > - if test "x$enable_linux_builtin" != xyes; then > > - grep -q -E '[[:space:]]mount_nodev[[:space:]]' \ > - $LINUX_OBJ/$LINUX_SYMBOLS 2>/dev/null > - rc=$? > - if test $rc -ne 0; then > - export=0 > - for file in fs/super.c; do > - grep -q -E "EXPORT_SYMBOL.*(mount_nodev)" \ > - "$LINUX/$file" 2>/dev/null > - rc=$? > - if test $rc -eq 0; then > - export=1 > - break; > - fi > - done > - if test $export -eq 0; then : > - rc=1 > - else : > - rc=0 > - fi > - else : > - rc=0 > - fi > - > - fi > - if test $rc -ne 0; then : > +else > + $as_echo "$as_me: failed program was:" >&5 > +sed 's/^/| /' conftest.$ac_ext >&5 > > - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 > + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 > $as_echo "no" >&6; } > > - else : > > - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 > -$as_echo "yes" >&6; } > - > -$as_echo "#define HAVE_MOUNT_NODEV 1" >>confdefs.h > > +fi > + rm -Rf build > > - fi > - fi > > > > @@ -30596,21 +30567,31 @@ fi > > > > - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mount_nodev() is available" >&5 > -$as_echo_n "checking whether mount_nodev() is available... " >&6; } > > + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether fst->mount() exists" >&5 > +$as_echo_n "checking whether fst->mount() exists... " >&6; } > > > cat confdefs.h - <<_ACEOF >conftest.c > > > - #include <linux/fs.h> > + #include <linux/fs.h> > + > + static struct dentry * > + mount(struct file_system_type *fs_type, int flags, > + const char *osname, void *data) { > + struct dentry *d = NULL; > + return (d); > + } > + > + static struct file_system_type fst __attribute__ ((unused)) = { > + .mount = mount, > + }; > > int > main (void) > { > > - mount_nodev(NULL, 0, NULL, NULL); > > ; > return 0; > @@ -30640,64 +30621,25 @@ _ACEOF > ac_status=$? > $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 > test $ac_status = 0; }; }; then : > - rc=0 > -else > - $as_echo "$as_me: failed program was:" >&5 > -sed 's/^/| /' conftest.$ac_ext >&5 > - rc=1 > - > > -fi > - rm -Rf build > - > - > - if test $rc -ne 0; then : > + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 > +$as_echo "yes" >&6; } > > - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 > -$as_echo "no" >&6; } > +$as_echo "#define HAVE_FST_MOUNT 1" >>confdefs.h > > - else > - if test "x$enable_linux_builtin" != xyes; then > > - grep -q -E '[[:space:]]mount_nodev[[:space:]]' \ > - $LINUX_OBJ/$LINUX_SYMBOLS 2>/dev/null > - rc=$? > - if test $rc -ne 0; then > - export=0 > - for file in fs/super.c; do > - grep -q -E "EXPORT_SYMBOL.*(mount_nodev)" \ > - "$LINUX/$file" 2>/dev/null > - rc=$? > - if test $rc -eq 0; then > - export=1 > - break; > - fi > - done > - if test $export -eq 0; then : > - rc=1 > - else : > - rc=0 > - fi > - else : > - rc=0 > - fi > - > - fi > - if test $rc -ne 0; then : > +else > + $as_echo "$as_me: failed program was:" >&5 > +sed 's/^/| /' conftest.$ac_ext >&5 > > - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 > + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 > $as_echo "no" >&6; } > > - else : > > - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 > -$as_echo "yes" >&6; } > - > -$as_echo "#define HAVE_MOUNT_NODEV 1" >>confdefs.h > > +fi > + rm -Rf build > > - fi > - fi > > > > diff --git a/zfs/contrib/Makefile.in b/zfs/contrib/Makefile.in > index 1ced2ca..c1204cd 100644 > --- a/zfs/contrib/Makefile.in > +++ b/zfs/contrib/Makefile.in > @@ -129,6 +129,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-file-inode.m4 \ > $(top_srcdir)/config/kernel-fmode-t.m4 \ > $(top_srcdir)/config/kernel-follow-down-one.m4 \ > + $(top_srcdir)/config/kernel-fst-mount.m4 \ > $(top_srcdir)/config/kernel-fsync.m4 \ > $(top_srcdir)/config/kernel-generic_io_acct.m4 \ > $(top_srcdir)/config/kernel-get-disk-ro.m4 \ > @@ -144,7 +145,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-lseek-execute.m4 \ > $(top_srcdir)/config/kernel-mk-request-fn.m4 \ > $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ > - $(top_srcdir)/config/kernel-mount-nodev.m4 \ > $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ > $(top_srcdir)/config/kernel-put-link.m4 \ > $(top_srcdir)/config/kernel-security-inode-init.m4 \ > diff --git a/zfs/contrib/bash_completion.d/Makefile.in b/zfs/contrib/bash_completion.d/Makefile.in > index a848010..f29d5cc 100644 > --- a/zfs/contrib/bash_completion.d/Makefile.in > +++ b/zfs/contrib/bash_completion.d/Makefile.in > @@ -130,6 +130,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-file-inode.m4 \ > $(top_srcdir)/config/kernel-fmode-t.m4 \ > $(top_srcdir)/config/kernel-follow-down-one.m4 \ > + $(top_srcdir)/config/kernel-fst-mount.m4 \ > $(top_srcdir)/config/kernel-fsync.m4 \ > $(top_srcdir)/config/kernel-generic_io_acct.m4 \ > $(top_srcdir)/config/kernel-get-disk-ro.m4 \ > @@ -145,7 +146,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-lseek-execute.m4 \ > $(top_srcdir)/config/kernel-mk-request-fn.m4 \ > $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ > - $(top_srcdir)/config/kernel-mount-nodev.m4 \ > $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ > $(top_srcdir)/config/kernel-put-link.m4 \ > $(top_srcdir)/config/kernel-security-inode-init.m4 \ > diff --git a/zfs/contrib/dracut/90zfs/Makefile.in b/zfs/contrib/dracut/90zfs/Makefile.in > index 80f3262..63da6ed 100644 > --- a/zfs/contrib/dracut/90zfs/Makefile.in > +++ b/zfs/contrib/dracut/90zfs/Makefile.in > @@ -130,6 +130,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-file-inode.m4 \ > $(top_srcdir)/config/kernel-fmode-t.m4 \ > $(top_srcdir)/config/kernel-follow-down-one.m4 \ > + $(top_srcdir)/config/kernel-fst-mount.m4 \ > $(top_srcdir)/config/kernel-fsync.m4 \ > $(top_srcdir)/config/kernel-generic_io_acct.m4 \ > $(top_srcdir)/config/kernel-get-disk-ro.m4 \ > @@ -145,7 +146,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-lseek-execute.m4 \ > $(top_srcdir)/config/kernel-mk-request-fn.m4 \ > $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ > - $(top_srcdir)/config/kernel-mount-nodev.m4 \ > $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ > $(top_srcdir)/config/kernel-put-link.m4 \ > $(top_srcdir)/config/kernel-security-inode-init.m4 \ > diff --git a/zfs/contrib/dracut/Makefile.in b/zfs/contrib/dracut/Makefile.in > index 5136e7f..eed070a 100644 > --- a/zfs/contrib/dracut/Makefile.in > +++ b/zfs/contrib/dracut/Makefile.in > @@ -129,6 +129,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-file-inode.m4 \ > $(top_srcdir)/config/kernel-fmode-t.m4 \ > $(top_srcdir)/config/kernel-follow-down-one.m4 \ > + $(top_srcdir)/config/kernel-fst-mount.m4 \ > $(top_srcdir)/config/kernel-fsync.m4 \ > $(top_srcdir)/config/kernel-generic_io_acct.m4 \ > $(top_srcdir)/config/kernel-get-disk-ro.m4 \ > @@ -144,7 +145,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-lseek-execute.m4 \ > $(top_srcdir)/config/kernel-mk-request-fn.m4 \ > $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ > - $(top_srcdir)/config/kernel-mount-nodev.m4 \ > $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ > $(top_srcdir)/config/kernel-put-link.m4 \ > $(top_srcdir)/config/kernel-security-inode-init.m4 \ > diff --git a/zfs/contrib/initramfs/Makefile.in b/zfs/contrib/initramfs/Makefile.in > index 5bf9c44..7a567be 100644 > --- a/zfs/contrib/initramfs/Makefile.in > +++ b/zfs/contrib/initramfs/Makefile.in > @@ -130,6 +130,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-file-inode.m4 \ > $(top_srcdir)/config/kernel-fmode-t.m4 \ > $(top_srcdir)/config/kernel-follow-down-one.m4 \ > + $(top_srcdir)/config/kernel-fst-mount.m4 \ > $(top_srcdir)/config/kernel-fsync.m4 \ > $(top_srcdir)/config/kernel-generic_io_acct.m4 \ > $(top_srcdir)/config/kernel-get-disk-ro.m4 \ > @@ -145,7 +146,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-lseek-execute.m4 \ > $(top_srcdir)/config/kernel-mk-request-fn.m4 \ > $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ > - $(top_srcdir)/config/kernel-mount-nodev.m4 \ > $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ > $(top_srcdir)/config/kernel-put-link.m4 \ > $(top_srcdir)/config/kernel-security-inode-init.m4 \ > diff --git a/zfs/include/Makefile.in b/zfs/include/Makefile.in > index 5dcbe26..be50bca 100644 > --- a/zfs/include/Makefile.in > +++ b/zfs/include/Makefile.in > @@ -130,6 +130,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-file-inode.m4 \ > $(top_srcdir)/config/kernel-fmode-t.m4 \ > $(top_srcdir)/config/kernel-follow-down-one.m4 \ > + $(top_srcdir)/config/kernel-fst-mount.m4 \ > $(top_srcdir)/config/kernel-fsync.m4 \ > $(top_srcdir)/config/kernel-generic_io_acct.m4 \ > $(top_srcdir)/config/kernel-get-disk-ro.m4 \ > @@ -145,7 +146,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-lseek-execute.m4 \ > $(top_srcdir)/config/kernel-mk-request-fn.m4 \ > $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ > - $(top_srcdir)/config/kernel-mount-nodev.m4 \ > $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ > $(top_srcdir)/config/kernel-put-link.m4 \ > $(top_srcdir)/config/kernel-security-inode-init.m4 \ > diff --git a/zfs/include/linux/Makefile.in b/zfs/include/linux/Makefile.in > index 52deade..70974df 100644 > --- a/zfs/include/linux/Makefile.in > +++ b/zfs/include/linux/Makefile.in > @@ -130,6 +130,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-file-inode.m4 \ > $(top_srcdir)/config/kernel-fmode-t.m4 \ > $(top_srcdir)/config/kernel-follow-down-one.m4 \ > + $(top_srcdir)/config/kernel-fst-mount.m4 \ > $(top_srcdir)/config/kernel-fsync.m4 \ > $(top_srcdir)/config/kernel-generic_io_acct.m4 \ > $(top_srcdir)/config/kernel-get-disk-ro.m4 \ > @@ -145,7 +146,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-lseek-execute.m4 \ > $(top_srcdir)/config/kernel-mk-request-fn.m4 \ > $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ > - $(top_srcdir)/config/kernel-mount-nodev.m4 \ > $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ > $(top_srcdir)/config/kernel-put-link.m4 \ > $(top_srcdir)/config/kernel-security-inode-init.m4 \ > diff --git a/zfs/include/linux/vfs_compat.h b/zfs/include/linux/vfs_compat.h > index 8037055..f440f36 100644 > --- a/zfs/include/linux/vfs_compat.h > +++ b/zfs/include/linux/vfs_compat.h > @@ -112,6 +112,30 @@ zpl_bdi_setup_and_register(struct backing_dev_info *bdi, char *name) > #endif > > /* > + * 4.14 adds SB_* flag definitions, define them to MS_* equivalents > + * if not set. > + */ > +#ifndef SB_RDONLY > +#define SB_RDONLY MS_RDONLY > +#endif > + > +#ifndef SB_SILENT > +#define SB_SILENT MS_SILENT > +#endif > + > +#ifndef SB_ACTIVE > +#define SB_ACTIVE MS_ACTIVE > +#endif > + > +#ifndef SB_POSIXACL > +#define SB_POSIXACL MS_POSIXACL > +#endif > + > +#ifndef SB_MANDLOCK > +#define SB_MANDLOCK MS_MANDLOCK > +#endif > + > +/* > * 2.6.38 API change, > * LOOKUP_RCU flag introduced to distinguish rcu-walk from ref-walk cases. > */ > diff --git a/zfs/include/sys/Makefile.in b/zfs/include/sys/Makefile.in > index 20f498f..c0a0c2d 100644 > --- a/zfs/include/sys/Makefile.in > +++ b/zfs/include/sys/Makefile.in > @@ -130,6 +130,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-file-inode.m4 \ > $(top_srcdir)/config/kernel-fmode-t.m4 \ > $(top_srcdir)/config/kernel-follow-down-one.m4 \ > + $(top_srcdir)/config/kernel-fst-mount.m4 \ > $(top_srcdir)/config/kernel-fsync.m4 \ > $(top_srcdir)/config/kernel-generic_io_acct.m4 \ > $(top_srcdir)/config/kernel-get-disk-ro.m4 \ > @@ -145,7 +146,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-lseek-execute.m4 \ > $(top_srcdir)/config/kernel-mk-request-fn.m4 \ > $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ > - $(top_srcdir)/config/kernel-mount-nodev.m4 \ > $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ > $(top_srcdir)/config/kernel-put-link.m4 \ > $(top_srcdir)/config/kernel-security-inode-init.m4 \ > diff --git a/zfs/include/sys/fm/Makefile.in b/zfs/include/sys/fm/Makefile.in > index d8d132f..b6f5397 100644 > --- a/zfs/include/sys/fm/Makefile.in > +++ b/zfs/include/sys/fm/Makefile.in > @@ -130,6 +130,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-file-inode.m4 \ > $(top_srcdir)/config/kernel-fmode-t.m4 \ > $(top_srcdir)/config/kernel-follow-down-one.m4 \ > + $(top_srcdir)/config/kernel-fst-mount.m4 \ > $(top_srcdir)/config/kernel-fsync.m4 \ > $(top_srcdir)/config/kernel-generic_io_acct.m4 \ > $(top_srcdir)/config/kernel-get-disk-ro.m4 \ > @@ -145,7 +146,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-lseek-execute.m4 \ > $(top_srcdir)/config/kernel-mk-request-fn.m4 \ > $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ > - $(top_srcdir)/config/kernel-mount-nodev.m4 \ > $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ > $(top_srcdir)/config/kernel-put-link.m4 \ > $(top_srcdir)/config/kernel-security-inode-init.m4 \ > diff --git a/zfs/include/sys/fm/fs/Makefile.in b/zfs/include/sys/fm/fs/Makefile.in > index 2c61a5e..a1216fb 100644 > --- a/zfs/include/sys/fm/fs/Makefile.in > +++ b/zfs/include/sys/fm/fs/Makefile.in > @@ -130,6 +130,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-file-inode.m4 \ > $(top_srcdir)/config/kernel-fmode-t.m4 \ > $(top_srcdir)/config/kernel-follow-down-one.m4 \ > + $(top_srcdir)/config/kernel-fst-mount.m4 \ > $(top_srcdir)/config/kernel-fsync.m4 \ > $(top_srcdir)/config/kernel-generic_io_acct.m4 \ > $(top_srcdir)/config/kernel-get-disk-ro.m4 \ > @@ -145,7 +146,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-lseek-execute.m4 \ > $(top_srcdir)/config/kernel-mk-request-fn.m4 \ > $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ > - $(top_srcdir)/config/kernel-mount-nodev.m4 \ > $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ > $(top_srcdir)/config/kernel-put-link.m4 \ > $(top_srcdir)/config/kernel-security-inode-init.m4 \ > diff --git a/zfs/include/sys/fs/Makefile.in b/zfs/include/sys/fs/Makefile.in > index 95d7b62..4715b29 100644 > --- a/zfs/include/sys/fs/Makefile.in > +++ b/zfs/include/sys/fs/Makefile.in > @@ -130,6 +130,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-file-inode.m4 \ > $(top_srcdir)/config/kernel-fmode-t.m4 \ > $(top_srcdir)/config/kernel-follow-down-one.m4 \ > + $(top_srcdir)/config/kernel-fst-mount.m4 \ > $(top_srcdir)/config/kernel-fsync.m4 \ > $(top_srcdir)/config/kernel-generic_io_acct.m4 \ > $(top_srcdir)/config/kernel-get-disk-ro.m4 \ > @@ -145,7 +146,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ > $(top_srcdir)/config/kernel-lseek-execute.m4 \ > $(top_srcdir)/config/kernel-mk-request-fn.m4 \ > $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ > - $(top_srcdir)/config/kernel-mount-nodev.m4 \ > $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ > $(top_srcdir)/config/kernel-put-link.m4 \ > $(top_srcdir)/config/kernel-security-inode-init.m4 \ > diff --git a/zfs/module/zfs/zpl_super.c b/zfs/module/zfs/zpl_super.c > index bcdbbd6..f75a0d8 100644 > --- a/zfs/module/zfs/zpl_super.c > +++ b/zfs/module/zfs/zpl_super.c > @@ -443,12 +443,56 @@ zpl_fill_super(struct super_block *sb, void *data, int silent) > return (error); > } > > -#ifdef HAVE_MOUNT_NODEV > +static int > +zpl_test_super(struct super_block *s, void *data) > +{ > + zfs_sb_t *zsb = s->s_fs_info; > + > + objset_t *os = data; > + > + if (zsb == NULL) > + return (0); > + > + return (os == zsb->z_os); > +} > + > +static struct super_block * > +zpl_mount_impl(struct file_system_type *fs_type, int flags, zfs_mntopts_t *zmo) > +{ > + struct super_block *s; > + objset_t *os; > + int err; > + > + err = dmu_objset_hold(zmo->z_osname, FTAG, &os); > + if (err) > + return (ERR_PTR(-err)); > + > + s = zpl_sget(fs_type, zpl_test_super, set_anon_super, flags, os); > + dmu_objset_rele(os, FTAG); > + if (IS_ERR(s)) > + return (ERR_CAST(s)); > + > + if (s->s_root == NULL) { > + err = zpl_fill_super(s, zmo, flags & SB_SILENT ? 1 : 0); > + if (err) { > + deactivate_locked_super(s); > + return (ERR_PTR(err)); > + } > + s->s_flags |= SB_ACTIVE; > + } else if ((flags ^ s->s_flags) & SB_RDONLY) { > + deactivate_locked_super(s); > + return (ERR_PTR(-EBUSY)); > + } > + > + return (s); > +} > +#ifdef HAVE_FST_MOUNT > static struct dentry * > zpl_mount(struct file_system_type *fs_type, int flags, > const char *osname, void *data) > { > zfs_mntopts_t *zmo = zfs_mntopts_alloc(); > + struct super_block *sb; > int error; > > error = zpl_parse_options((char *)osname, (char *)data, zmo, B_FALSE); > @@ -456,8 +500,11 @@ zpl_mount(struct file_system_type *fs_type, int flags, > zfs_mntopts_free(zmo); > return (ERR_PTR(error)); > } > + sb = zpl_mount_impl(fs_type, flags, zmo); > + if (IS_ERR(sb)) > + return (ERR_CAST(sb)); > > - return (mount_nodev(fs_type, flags, zmo, zpl_fill_super)); > + return (dget(sb->s_root)); > } > #else > static int > @@ -465,6 +512,7 @@ zpl_get_sb(struct file_system_type *fs_type, int flags, > const char *osname, void *data, struct vfsmount *mnt) > { > zfs_mntopts_t *zmo = zfs_mntopts_alloc(); > + struct super_block *sb; > int error; > > error = zpl_parse_options((char *)osname, (char *)data, zmo, B_FALSE); > @@ -472,10 +520,15 @@ zpl_get_sb(struct file_system_type *fs_type, int flags, > zfs_mntopts_free(zmo); > return (error); > } > + sb = zpl_mount_impl(fs_type, flags, zmo); > + if (IS_ERR(sb)) > + return (ERR_CAST(sb)); > + > + (void) simple_set_mnt(mnt, sb); > > - return (get_sb_nodev(fs_type, flags, zmo, zpl_fill_super, mnt)); > + return (0); > } > -#endif /* HAVE_MOUNT_NODEV */ > +#endif /* HAVE_FST_MOUNT */ > > static void > zpl_kill_sb(struct super_block *sb) > @@ -542,10 +595,10 @@ const struct super_operations zpl_super_operations = { > struct file_system_type zpl_fs_type = { > .owner = THIS_MODULE, > .name = ZFS_DRIVER, > -#ifdef HAVE_MOUNT_NODEV > +#ifdef HAVE_FST_MOUNT > .mount = zpl_mount, > #else > .get_sb = zpl_get_sb, > -#endif /* HAVE_MOUNT_NODEV */ > +#endif /* HAVE_FST_MOUNT */ > .kill_sb = zpl_kill_sb, > }; > diff --git a/zfs/zfs_config.h.in b/zfs/zfs_config.h.in > index c5026c8..60cf471 100644 > --- a/zfs/zfs_config.h.in > +++ b/zfs/zfs_config.h.in > @@ -162,6 +162,9 @@ > /* sops->free_cached_objects() exists */ > #undef HAVE_FREE_CACHED_OBJECTS > > +/* fst->mount() exists */ > +#undef HAVE_FST_MOUNT > + > /* fops->fsync() with range */ > #undef HAVE_FSYNC_RANGE > > @@ -252,9 +255,6 @@ > /* Define to 1 if you have the `mlockall' function. */ > #undef HAVE_MLOCKALL > > -/* mount_nodev() is available */ > -#undef HAVE_MOUNT_NODEV > - > /* sops->nr_cached_objects() exists */ > #undef HAVE_NR_CACHED_OBJECTS > > Applied to xenial/master-next branch. Thanks, Kleber
diff --git a/zfs/META b/zfs/META index 6c7026c..6837592 100644 --- a/zfs/META +++ b/zfs/META @@ -2,7 +2,7 @@ Meta: 1 Name: zfs Branch: 1.0 Version: 0.6.5.6 -Release: 0ubuntu20 +Release: 0ubuntu24 Release-Tags: relext License: CDDL Author: OpenZFS on Linux diff --git a/zfs/Makefile.in b/zfs/Makefile.in index 8f68539..f9b0f69 100644 --- a/zfs/Makefile.in +++ b/zfs/Makefile.in @@ -140,6 +140,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ $(top_srcdir)/config/kernel-file-inode.m4 \ $(top_srcdir)/config/kernel-fmode-t.m4 \ $(top_srcdir)/config/kernel-follow-down-one.m4 \ + $(top_srcdir)/config/kernel-fst-mount.m4 \ $(top_srcdir)/config/kernel-fsync.m4 \ $(top_srcdir)/config/kernel-generic_io_acct.m4 \ $(top_srcdir)/config/kernel-get-disk-ro.m4 \ @@ -155,7 +156,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ $(top_srcdir)/config/kernel-lseek-execute.m4 \ $(top_srcdir)/config/kernel-mk-request-fn.m4 \ $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ - $(top_srcdir)/config/kernel-mount-nodev.m4 \ $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ $(top_srcdir)/config/kernel-put-link.m4 \ $(top_srcdir)/config/kernel-security-inode-init.m4 \ diff --git a/zfs/aclocal.m4 b/zfs/aclocal.m4 index 391fd54..75a4bfe 100644 --- a/zfs/aclocal.m4 +++ b/zfs/aclocal.m4 @@ -1245,6 +1245,7 @@ m4_include([config/kernel-fallocate.m4]) m4_include([config/kernel-file-inode.m4]) m4_include([config/kernel-fmode-t.m4]) m4_include([config/kernel-follow-down-one.m4]) +m4_include([config/kernel-fst-mount.m4]) m4_include([config/kernel-fsync.m4]) m4_include([config/kernel-generic_io_acct.m4]) m4_include([config/kernel-get-disk-ro.m4]) @@ -1260,7 +1261,6 @@ m4_include([config/kernel-lookup-nameidata.m4]) m4_include([config/kernel-lseek-execute.m4]) m4_include([config/kernel-mk-request-fn.m4]) m4_include([config/kernel-mkdir-umode-t.m4]) -m4_include([config/kernel-mount-nodev.m4]) m4_include([config/kernel-open-bdev-exclusive.m4]) m4_include([config/kernel-put-link.m4]) m4_include([config/kernel-security-inode-init.m4]) diff --git a/zfs/config/kernel-fst-mount.m4 b/zfs/config/kernel-fst-mount.m4 new file mode 100644 index 0000000..a8ac50b --- /dev/null +++ b/zfs/config/kernel-fst-mount.m4 @@ -0,0 +1,28 @@ +dnl # +dnl # 2.6.38 API change +dnl # The .get_sb callback has been replaced by a .mount callback +dnl # in the file_system_type structure. +dnl # +AC_DEFUN([ZFS_AC_KERNEL_FST_MOUNT], [ + AC_MSG_CHECKING([whether fst->mount() exists]) + ZFS_LINUX_TRY_COMPILE([ + #include <linux/fs.h> + + static struct dentry * + mount(struct file_system_type *fs_type, int flags, + const char *osname, void *data) { + struct dentry *d = NULL; + return (d); + } + + static struct file_system_type fst __attribute__ ((unused)) = { + .mount = mount, + }; + ],[ + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_FST_MOUNT, 1, [fst->mount() exists]) + ],[ + AC_MSG_RESULT(no) + ]) +]) diff --git a/zfs/config/kernel-mount-nodev.m4 b/zfs/config/kernel-mount-nodev.m4 deleted file mode 100644 index 28a4515..0000000 --- a/zfs/config/kernel-mount-nodev.m4 +++ /dev/null @@ -1,20 +0,0 @@ -dnl # -dnl # 2.6.39 API change -dnl # The .get_sb callback has been replaced by a .mount callback -dnl # in the file_system_type structure. When using the new -dnl # interface the caller must now use the mount_nodev() helper. -dnl # This updated callback and helper no longer pass the vfsmount. -dnl # -AC_DEFUN([ZFS_AC_KERNEL_MOUNT_NODEV], - [AC_MSG_CHECKING([whether mount_nodev() is available]) - ZFS_LINUX_TRY_COMPILE_SYMBOL([ - #include <linux/fs.h> - ], [ - mount_nodev(NULL, 0, NULL, NULL); - ], [mount_nodev], [fs/super.c], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_MOUNT_NODEV, 1, [mount_nodev() is available]) - ], [ - AC_MSG_RESULT(no) - ]) -]) diff --git a/zfs/config/kernel.m4 b/zfs/config/kernel.m4 index 0eddc2f..0ba5f07d 100644 --- a/zfs/config/kernel.m4 +++ b/zfs/config/kernel.m4 @@ -77,7 +77,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [ ZFS_AC_KERNEL_TRUNCATE_SETSIZE ZFS_AC_KERNEL_6ARGS_SECURITY_INODE_INIT_SECURITY ZFS_AC_KERNEL_CALLBACK_SECURITY_INODE_INIT_SECURITY - ZFS_AC_KERNEL_MOUNT_NODEV + ZFS_AC_KERNEL_FST_MOUNT ZFS_AC_KERNEL_SHRINK ZFS_AC_KERNEL_SHRINK_CONTROL_HAS_NID ZFS_AC_KERNEL_S_INSTANCES_LIST_HEAD diff --git a/zfs/configure b/zfs/configure index 8d61725..502dec9 100755 --- a/zfs/configure +++ b/zfs/configure @@ -21202,21 +21202,31 @@ fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mount_nodev() is available" >&5 -$as_echo_n "checking whether mount_nodev() is available... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether fst->mount() exists" >&5 +$as_echo_n "checking whether fst->mount() exists... " >&6; } cat confdefs.h - <<_ACEOF >conftest.c - #include <linux/fs.h> + #include <linux/fs.h> + + static struct dentry * + mount(struct file_system_type *fs_type, int flags, + const char *osname, void *data) { + struct dentry *d = NULL; + return (d); + } + + static struct file_system_type fst __attribute__ ((unused)) = { + .mount = mount, + }; int main (void) { - mount_nodev(NULL, 0, NULL, NULL); ; return 0; @@ -21246,64 +21256,25 @@ _ACEOF ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : - rc=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - rc=1 - -fi - rm -Rf build - - - if test $rc -ne 0; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +$as_echo "#define HAVE_FST_MOUNT 1" >>confdefs.h - else - if test "x$enable_linux_builtin" != xyes; then - grep -q -E '[[:space:]]mount_nodev[[:space:]]' \ - $LINUX_OBJ/$LINUX_SYMBOLS 2>/dev/null - rc=$? - if test $rc -ne 0; then - export=0 - for file in fs/super.c; do - grep -q -E "EXPORT_SYMBOL.*(mount_nodev)" \ - "$LINUX/$file" 2>/dev/null - rc=$? - if test $rc -eq 0; then - export=1 - break; - fi - done - if test $export -eq 0; then : - rc=1 - else : - rc=0 - fi - else : - rc=0 - fi - - fi - if test $rc -ne 0; then : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - else : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -$as_echo "#define HAVE_MOUNT_NODEV 1" >>confdefs.h +fi + rm -Rf build - fi - fi @@ -30596,21 +30567,31 @@ fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mount_nodev() is available" >&5 -$as_echo_n "checking whether mount_nodev() is available... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether fst->mount() exists" >&5 +$as_echo_n "checking whether fst->mount() exists... " >&6; } cat confdefs.h - <<_ACEOF >conftest.c - #include <linux/fs.h> + #include <linux/fs.h> + + static struct dentry * + mount(struct file_system_type *fs_type, int flags, + const char *osname, void *data) { + struct dentry *d = NULL; + return (d); + } + + static struct file_system_type fst __attribute__ ((unused)) = { + .mount = mount, + }; int main (void) { - mount_nodev(NULL, 0, NULL, NULL); ; return 0; @@ -30640,64 +30621,25 @@ _ACEOF ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : - rc=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - rc=1 - -fi - rm -Rf build - - - if test $rc -ne 0; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +$as_echo "#define HAVE_FST_MOUNT 1" >>confdefs.h - else - if test "x$enable_linux_builtin" != xyes; then - grep -q -E '[[:space:]]mount_nodev[[:space:]]' \ - $LINUX_OBJ/$LINUX_SYMBOLS 2>/dev/null - rc=$? - if test $rc -ne 0; then - export=0 - for file in fs/super.c; do - grep -q -E "EXPORT_SYMBOL.*(mount_nodev)" \ - "$LINUX/$file" 2>/dev/null - rc=$? - if test $rc -eq 0; then - export=1 - break; - fi - done - if test $export -eq 0; then : - rc=1 - else : - rc=0 - fi - else : - rc=0 - fi - - fi - if test $rc -ne 0; then : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - else : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -$as_echo "#define HAVE_MOUNT_NODEV 1" >>confdefs.h +fi + rm -Rf build - fi - fi diff --git a/zfs/contrib/Makefile.in b/zfs/contrib/Makefile.in index 1ced2ca..c1204cd 100644 --- a/zfs/contrib/Makefile.in +++ b/zfs/contrib/Makefile.in @@ -129,6 +129,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ $(top_srcdir)/config/kernel-file-inode.m4 \ $(top_srcdir)/config/kernel-fmode-t.m4 \ $(top_srcdir)/config/kernel-follow-down-one.m4 \ + $(top_srcdir)/config/kernel-fst-mount.m4 \ $(top_srcdir)/config/kernel-fsync.m4 \ $(top_srcdir)/config/kernel-generic_io_acct.m4 \ $(top_srcdir)/config/kernel-get-disk-ro.m4 \ @@ -144,7 +145,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ $(top_srcdir)/config/kernel-lseek-execute.m4 \ $(top_srcdir)/config/kernel-mk-request-fn.m4 \ $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ - $(top_srcdir)/config/kernel-mount-nodev.m4 \ $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ $(top_srcdir)/config/kernel-put-link.m4 \ $(top_srcdir)/config/kernel-security-inode-init.m4 \ diff --git a/zfs/contrib/bash_completion.d/Makefile.in b/zfs/contrib/bash_completion.d/Makefile.in index a848010..f29d5cc 100644 --- a/zfs/contrib/bash_completion.d/Makefile.in +++ b/zfs/contrib/bash_completion.d/Makefile.in @@ -130,6 +130,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ $(top_srcdir)/config/kernel-file-inode.m4 \ $(top_srcdir)/config/kernel-fmode-t.m4 \ $(top_srcdir)/config/kernel-follow-down-one.m4 \ + $(top_srcdir)/config/kernel-fst-mount.m4 \ $(top_srcdir)/config/kernel-fsync.m4 \ $(top_srcdir)/config/kernel-generic_io_acct.m4 \ $(top_srcdir)/config/kernel-get-disk-ro.m4 \ @@ -145,7 +146,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ $(top_srcdir)/config/kernel-lseek-execute.m4 \ $(top_srcdir)/config/kernel-mk-request-fn.m4 \ $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ - $(top_srcdir)/config/kernel-mount-nodev.m4 \ $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ $(top_srcdir)/config/kernel-put-link.m4 \ $(top_srcdir)/config/kernel-security-inode-init.m4 \ diff --git a/zfs/contrib/dracut/90zfs/Makefile.in b/zfs/contrib/dracut/90zfs/Makefile.in index 80f3262..63da6ed 100644 --- a/zfs/contrib/dracut/90zfs/Makefile.in +++ b/zfs/contrib/dracut/90zfs/Makefile.in @@ -130,6 +130,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ $(top_srcdir)/config/kernel-file-inode.m4 \ $(top_srcdir)/config/kernel-fmode-t.m4 \ $(top_srcdir)/config/kernel-follow-down-one.m4 \ + $(top_srcdir)/config/kernel-fst-mount.m4 \ $(top_srcdir)/config/kernel-fsync.m4 \ $(top_srcdir)/config/kernel-generic_io_acct.m4 \ $(top_srcdir)/config/kernel-get-disk-ro.m4 \ @@ -145,7 +146,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ $(top_srcdir)/config/kernel-lseek-execute.m4 \ $(top_srcdir)/config/kernel-mk-request-fn.m4 \ $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ - $(top_srcdir)/config/kernel-mount-nodev.m4 \ $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ $(top_srcdir)/config/kernel-put-link.m4 \ $(top_srcdir)/config/kernel-security-inode-init.m4 \ diff --git a/zfs/contrib/dracut/Makefile.in b/zfs/contrib/dracut/Makefile.in index 5136e7f..eed070a 100644 --- a/zfs/contrib/dracut/Makefile.in +++ b/zfs/contrib/dracut/Makefile.in @@ -129,6 +129,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ $(top_srcdir)/config/kernel-file-inode.m4 \ $(top_srcdir)/config/kernel-fmode-t.m4 \ $(top_srcdir)/config/kernel-follow-down-one.m4 \ + $(top_srcdir)/config/kernel-fst-mount.m4 \ $(top_srcdir)/config/kernel-fsync.m4 \ $(top_srcdir)/config/kernel-generic_io_acct.m4 \ $(top_srcdir)/config/kernel-get-disk-ro.m4 \ @@ -144,7 +145,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ $(top_srcdir)/config/kernel-lseek-execute.m4 \ $(top_srcdir)/config/kernel-mk-request-fn.m4 \ $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ - $(top_srcdir)/config/kernel-mount-nodev.m4 \ $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ $(top_srcdir)/config/kernel-put-link.m4 \ $(top_srcdir)/config/kernel-security-inode-init.m4 \ diff --git a/zfs/contrib/initramfs/Makefile.in b/zfs/contrib/initramfs/Makefile.in index 5bf9c44..7a567be 100644 --- a/zfs/contrib/initramfs/Makefile.in +++ b/zfs/contrib/initramfs/Makefile.in @@ -130,6 +130,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ $(top_srcdir)/config/kernel-file-inode.m4 \ $(top_srcdir)/config/kernel-fmode-t.m4 \ $(top_srcdir)/config/kernel-follow-down-one.m4 \ + $(top_srcdir)/config/kernel-fst-mount.m4 \ $(top_srcdir)/config/kernel-fsync.m4 \ $(top_srcdir)/config/kernel-generic_io_acct.m4 \ $(top_srcdir)/config/kernel-get-disk-ro.m4 \ @@ -145,7 +146,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ $(top_srcdir)/config/kernel-lseek-execute.m4 \ $(top_srcdir)/config/kernel-mk-request-fn.m4 \ $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ - $(top_srcdir)/config/kernel-mount-nodev.m4 \ $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ $(top_srcdir)/config/kernel-put-link.m4 \ $(top_srcdir)/config/kernel-security-inode-init.m4 \ diff --git a/zfs/include/Makefile.in b/zfs/include/Makefile.in index 5dcbe26..be50bca 100644 --- a/zfs/include/Makefile.in +++ b/zfs/include/Makefile.in @@ -130,6 +130,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ $(top_srcdir)/config/kernel-file-inode.m4 \ $(top_srcdir)/config/kernel-fmode-t.m4 \ $(top_srcdir)/config/kernel-follow-down-one.m4 \ + $(top_srcdir)/config/kernel-fst-mount.m4 \ $(top_srcdir)/config/kernel-fsync.m4 \ $(top_srcdir)/config/kernel-generic_io_acct.m4 \ $(top_srcdir)/config/kernel-get-disk-ro.m4 \ @@ -145,7 +146,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ $(top_srcdir)/config/kernel-lseek-execute.m4 \ $(top_srcdir)/config/kernel-mk-request-fn.m4 \ $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ - $(top_srcdir)/config/kernel-mount-nodev.m4 \ $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ $(top_srcdir)/config/kernel-put-link.m4 \ $(top_srcdir)/config/kernel-security-inode-init.m4 \ diff --git a/zfs/include/linux/Makefile.in b/zfs/include/linux/Makefile.in index 52deade..70974df 100644 --- a/zfs/include/linux/Makefile.in +++ b/zfs/include/linux/Makefile.in @@ -130,6 +130,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ $(top_srcdir)/config/kernel-file-inode.m4 \ $(top_srcdir)/config/kernel-fmode-t.m4 \ $(top_srcdir)/config/kernel-follow-down-one.m4 \ + $(top_srcdir)/config/kernel-fst-mount.m4 \ $(top_srcdir)/config/kernel-fsync.m4 \ $(top_srcdir)/config/kernel-generic_io_acct.m4 \ $(top_srcdir)/config/kernel-get-disk-ro.m4 \ @@ -145,7 +146,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ $(top_srcdir)/config/kernel-lseek-execute.m4 \ $(top_srcdir)/config/kernel-mk-request-fn.m4 \ $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ - $(top_srcdir)/config/kernel-mount-nodev.m4 \ $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ $(top_srcdir)/config/kernel-put-link.m4 \ $(top_srcdir)/config/kernel-security-inode-init.m4 \ diff --git a/zfs/include/linux/vfs_compat.h b/zfs/include/linux/vfs_compat.h index 8037055..f440f36 100644 --- a/zfs/include/linux/vfs_compat.h +++ b/zfs/include/linux/vfs_compat.h @@ -112,6 +112,30 @@ zpl_bdi_setup_and_register(struct backing_dev_info *bdi, char *name) #endif /* + * 4.14 adds SB_* flag definitions, define them to MS_* equivalents + * if not set. + */ +#ifndef SB_RDONLY +#define SB_RDONLY MS_RDONLY +#endif + +#ifndef SB_SILENT +#define SB_SILENT MS_SILENT +#endif + +#ifndef SB_ACTIVE +#define SB_ACTIVE MS_ACTIVE +#endif + +#ifndef SB_POSIXACL +#define SB_POSIXACL MS_POSIXACL +#endif + +#ifndef SB_MANDLOCK +#define SB_MANDLOCK MS_MANDLOCK +#endif + +/* * 2.6.38 API change, * LOOKUP_RCU flag introduced to distinguish rcu-walk from ref-walk cases. */ diff --git a/zfs/include/sys/Makefile.in b/zfs/include/sys/Makefile.in index 20f498f..c0a0c2d 100644 --- a/zfs/include/sys/Makefile.in +++ b/zfs/include/sys/Makefile.in @@ -130,6 +130,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ $(top_srcdir)/config/kernel-file-inode.m4 \ $(top_srcdir)/config/kernel-fmode-t.m4 \ $(top_srcdir)/config/kernel-follow-down-one.m4 \ + $(top_srcdir)/config/kernel-fst-mount.m4 \ $(top_srcdir)/config/kernel-fsync.m4 \ $(top_srcdir)/config/kernel-generic_io_acct.m4 \ $(top_srcdir)/config/kernel-get-disk-ro.m4 \ @@ -145,7 +146,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ $(top_srcdir)/config/kernel-lseek-execute.m4 \ $(top_srcdir)/config/kernel-mk-request-fn.m4 \ $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ - $(top_srcdir)/config/kernel-mount-nodev.m4 \ $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ $(top_srcdir)/config/kernel-put-link.m4 \ $(top_srcdir)/config/kernel-security-inode-init.m4 \ diff --git a/zfs/include/sys/fm/Makefile.in b/zfs/include/sys/fm/Makefile.in index d8d132f..b6f5397 100644 --- a/zfs/include/sys/fm/Makefile.in +++ b/zfs/include/sys/fm/Makefile.in @@ -130,6 +130,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ $(top_srcdir)/config/kernel-file-inode.m4 \ $(top_srcdir)/config/kernel-fmode-t.m4 \ $(top_srcdir)/config/kernel-follow-down-one.m4 \ + $(top_srcdir)/config/kernel-fst-mount.m4 \ $(top_srcdir)/config/kernel-fsync.m4 \ $(top_srcdir)/config/kernel-generic_io_acct.m4 \ $(top_srcdir)/config/kernel-get-disk-ro.m4 \ @@ -145,7 +146,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ $(top_srcdir)/config/kernel-lseek-execute.m4 \ $(top_srcdir)/config/kernel-mk-request-fn.m4 \ $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ - $(top_srcdir)/config/kernel-mount-nodev.m4 \ $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ $(top_srcdir)/config/kernel-put-link.m4 \ $(top_srcdir)/config/kernel-security-inode-init.m4 \ diff --git a/zfs/include/sys/fm/fs/Makefile.in b/zfs/include/sys/fm/fs/Makefile.in index 2c61a5e..a1216fb 100644 --- a/zfs/include/sys/fm/fs/Makefile.in +++ b/zfs/include/sys/fm/fs/Makefile.in @@ -130,6 +130,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ $(top_srcdir)/config/kernel-file-inode.m4 \ $(top_srcdir)/config/kernel-fmode-t.m4 \ $(top_srcdir)/config/kernel-follow-down-one.m4 \ + $(top_srcdir)/config/kernel-fst-mount.m4 \ $(top_srcdir)/config/kernel-fsync.m4 \ $(top_srcdir)/config/kernel-generic_io_acct.m4 \ $(top_srcdir)/config/kernel-get-disk-ro.m4 \ @@ -145,7 +146,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ $(top_srcdir)/config/kernel-lseek-execute.m4 \ $(top_srcdir)/config/kernel-mk-request-fn.m4 \ $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ - $(top_srcdir)/config/kernel-mount-nodev.m4 \ $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ $(top_srcdir)/config/kernel-put-link.m4 \ $(top_srcdir)/config/kernel-security-inode-init.m4 \ diff --git a/zfs/include/sys/fs/Makefile.in b/zfs/include/sys/fs/Makefile.in index 95d7b62..4715b29 100644 --- a/zfs/include/sys/fs/Makefile.in +++ b/zfs/include/sys/fs/Makefile.in @@ -130,6 +130,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ $(top_srcdir)/config/kernel-file-inode.m4 \ $(top_srcdir)/config/kernel-fmode-t.m4 \ $(top_srcdir)/config/kernel-follow-down-one.m4 \ + $(top_srcdir)/config/kernel-fst-mount.m4 \ $(top_srcdir)/config/kernel-fsync.m4 \ $(top_srcdir)/config/kernel-generic_io_acct.m4 \ $(top_srcdir)/config/kernel-get-disk-ro.m4 \ @@ -145,7 +146,6 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \ $(top_srcdir)/config/kernel-lseek-execute.m4 \ $(top_srcdir)/config/kernel-mk-request-fn.m4 \ $(top_srcdir)/config/kernel-mkdir-umode-t.m4 \ - $(top_srcdir)/config/kernel-mount-nodev.m4 \ $(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \ $(top_srcdir)/config/kernel-put-link.m4 \ $(top_srcdir)/config/kernel-security-inode-init.m4 \ diff --git a/zfs/module/zfs/zpl_super.c b/zfs/module/zfs/zpl_super.c index bcdbbd6..f75a0d8 100644 --- a/zfs/module/zfs/zpl_super.c +++ b/zfs/module/zfs/zpl_super.c @@ -443,12 +443,56 @@ zpl_fill_super(struct super_block *sb, void *data, int silent) return (error); } -#ifdef HAVE_MOUNT_NODEV +static int +zpl_test_super(struct super_block *s, void *data) +{ + zfs_sb_t *zsb = s->s_fs_info; + + objset_t *os = data; + + if (zsb == NULL) + return (0); + + return (os == zsb->z_os); +} + +static struct super_block * +zpl_mount_impl(struct file_system_type *fs_type, int flags, zfs_mntopts_t *zmo) +{ + struct super_block *s; + objset_t *os; + int err; + + err = dmu_objset_hold(zmo->z_osname, FTAG, &os); + if (err) + return (ERR_PTR(-err)); + + s = zpl_sget(fs_type, zpl_test_super, set_anon_super, flags, os); + dmu_objset_rele(os, FTAG); + if (IS_ERR(s)) + return (ERR_CAST(s)); + + if (s->s_root == NULL) { + err = zpl_fill_super(s, zmo, flags & SB_SILENT ? 1 : 0); + if (err) { + deactivate_locked_super(s); + return (ERR_PTR(err)); + } + s->s_flags |= SB_ACTIVE; + } else if ((flags ^ s->s_flags) & SB_RDONLY) { + deactivate_locked_super(s); + return (ERR_PTR(-EBUSY)); + } + + return (s); +} +#ifdef HAVE_FST_MOUNT static struct dentry * zpl_mount(struct file_system_type *fs_type, int flags, const char *osname, void *data) { zfs_mntopts_t *zmo = zfs_mntopts_alloc(); + struct super_block *sb; int error; error = zpl_parse_options((char *)osname, (char *)data, zmo, B_FALSE); @@ -456,8 +500,11 @@ zpl_mount(struct file_system_type *fs_type, int flags, zfs_mntopts_free(zmo); return (ERR_PTR(error)); } + sb = zpl_mount_impl(fs_type, flags, zmo); + if (IS_ERR(sb)) + return (ERR_CAST(sb)); - return (mount_nodev(fs_type, flags, zmo, zpl_fill_super)); + return (dget(sb->s_root)); } #else static int @@ -465,6 +512,7 @@ zpl_get_sb(struct file_system_type *fs_type, int flags, const char *osname, void *data, struct vfsmount *mnt) { zfs_mntopts_t *zmo = zfs_mntopts_alloc(); + struct super_block *sb; int error; error = zpl_parse_options((char *)osname, (char *)data, zmo, B_FALSE); @@ -472,10 +520,15 @@ zpl_get_sb(struct file_system_type *fs_type, int flags, zfs_mntopts_free(zmo); return (error); } + sb = zpl_mount_impl(fs_type, flags, zmo); + if (IS_ERR(sb)) + return (ERR_CAST(sb)); + + (void) simple_set_mnt(mnt, sb); - return (get_sb_nodev(fs_type, flags, zmo, zpl_fill_super, mnt)); + return (0); } -#endif /* HAVE_MOUNT_NODEV */ +#endif /* HAVE_FST_MOUNT */ static void zpl_kill_sb(struct super_block *sb) @@ -542,10 +595,10 @@ const struct super_operations zpl_super_operations = { struct file_system_type zpl_fs_type = { .owner = THIS_MODULE, .name = ZFS_DRIVER, -#ifdef HAVE_MOUNT_NODEV +#ifdef HAVE_FST_MOUNT .mount = zpl_mount, #else .get_sb = zpl_get_sb, -#endif /* HAVE_MOUNT_NODEV */ +#endif /* HAVE_FST_MOUNT */ .kill_sb = zpl_kill_sb, }; diff --git a/zfs/zfs_config.h.in b/zfs/zfs_config.h.in index c5026c8..60cf471 100644 --- a/zfs/zfs_config.h.in +++ b/zfs/zfs_config.h.in @@ -162,6 +162,9 @@ /* sops->free_cached_objects() exists */ #undef HAVE_FREE_CACHED_OBJECTS +/* fst->mount() exists */ +#undef HAVE_FST_MOUNT + /* fops->fsync() with range */ #undef HAVE_FSYNC_RANGE @@ -252,9 +255,6 @@ /* Define to 1 if you have the `mlockall' function. */ #undef HAVE_MLOCKALL -/* mount_nodev() is available */ -#undef HAVE_MOUNT_NODEV - /* sops->nr_cached_objects() exists */ #undef HAVE_NR_CACHED_OBJECTS