mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 19:19:32 +03:00
93b43af10d
Currently mounting an already mounted zfs dataset results in an error, whereas it is typically allowed with other filesystems. This causes some bad interactions with mount namespaces. Take this sequence for example: - Create a dataset - Create a snapshot of the dataset - Create a clone of the snapshot - Create a new mount namespace - Rename the original dataset The rename results in unmounting and remounting the clone in the original mount namespace, however the remount fails because the dataset is still mounted in the new mount namespace. (Note that this means the mount in the new mount namespace is never being unmounted, so perhaps the unmount/remount of the clone isn't actually necessary.) The problem here is a result of the way mounting is implemented in the kernel module. Since it is not mounting block devices it uses mount_nodev() instead of the usual mount_bdev(). However, mount_nodev() is written for filesystems for which each mount is a new instance (i.e. a new super block), and zfs should be able to detect when a mount request can be satisfied using an existing super block. Change zpl_mount() to call sget() directly with it's own test callback. Passing the objset_t object as the fs data allows checking if a superblock already exists for the dataset, and in that case we just need to return a new reference for the sb's root dentry. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Tom Caputi <tcaputi@datto.com> Signed-off-by: Alek Pinchuk <apinchuk@datto.com> Signed-off-by: Seth Forshee <seth.forshee@canonical.com> Closes #5796 Closes #7207
29 lines
897 B
Plaintext
29 lines
897 B
Plaintext
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)
|
|
])
|
|
])
|