$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
{ MNTOPT_QUIET, MS_SILENT, ZS_COMMENT },
#endif
/* Custom zfs options */
+ { MNTOPT_XATTR, MS_COMMENT, ZS_COMMENT },
{ MNTOPT_NOXATTR, MS_COMMENT, ZS_COMMENT },
{ MNTOPT_ZFSUTIL, MS_COMMENT, ZS_ZFSUTIL },
{ NULL, 0, 0 } };
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
--- /dev/null
+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], [
+ ZFS_CHECK_SYMBOL_EXPORT(
+ [mount_nodev],
+ [fs/super.c],
+ [AC_DEFINE(HAVE_MOUNT_NODEV, 1,
+ [mount_nodev() is available])],
+ [])
+])
ZFS_AC_KERNEL_CHECK_DISK_SIZE_CHANGE
ZFS_AC_KERNEL_TRUNCATE_SETSIZE
ZFS_AC_KERNEL_6ARGS_SECURITY_INODE_INIT_SECURITY
+ ZFS_AC_KERNEL_MOUNT_NODEV
if test "$LINUX_OBJ" != "$LINUX"; then
KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$LINUX_OBJ"
EXTRA_KCFLAGS="$tmp_flags"
+ { $as_echo "$as_me:$LINENO: checking whether symbol mount_nodev is exported" >&5
+$as_echo_n "checking whether symbol mount_nodev is exported... " >&6; }
+ 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
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+
+ else
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_MOUNT_NODEV 1
+_ACEOF
+
+ fi
+ else
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_MOUNT_NODEV 1
+_ACEOF
+
+ fi
+
+
+
if test "$LINUX_OBJ" != "$LINUX"; then
KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$LINUX_OBJ"
fi
EXTRA_KCFLAGS="$tmp_flags"
+ { $as_echo "$as_me:$LINENO: checking whether symbol mount_nodev is exported" >&5
+$as_echo_n "checking whether symbol mount_nodev is exported... " >&6; }
+ 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
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+
+ else
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_MOUNT_NODEV 1
+_ACEOF
+
+ fi
+ else
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_MOUNT_NODEV 1
+_ACEOF
+
+ fi
+
+
+
if test "$LINUX_OBJ" != "$LINUX"; then
KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$LINUX_OBJ"
fi
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
uint64_t *propvalue);
extern int zfs_prop_get_userquota(zfs_handle_t *zhp, const char *propname,
char *propbuf, int proplen, boolean_t literal);
+extern uint64_t getprop_uint64(zfs_handle_t *, zfs_prop_t, char **);
extern uint64_t zfs_prop_get_int(zfs_handle_t *, zfs_prop_t);
extern int zfs_prop_inherit(zfs_handle_t *, const char *, boolean_t);
extern const char *zfs_prop_values(zfs_prop_t);
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
struct znode;
typedef struct zfs_sb {
- struct vfsmount *z_vfs; /* generic vfs struct */
struct super_block *z_sb; /* generic super_block */
struct zfs_sb *z_parent; /* parent fs */
objset_t *z_os; /* objset reference */
#define ZFS_SUPER_MAGIC 0x2fc12fc1
-#define ZSB_XATTR_USER 0x0001 /* Enable user xattrs */
+#define ZSB_XATTR 0x0001 /* Enable user xattrs */
/*
extern int zfs_sb_create(const char *name, zfs_sb_t **zsbp);
extern void zfs_sb_free(zfs_sb_t *zsb);
extern int zfs_check_global_label(const char *dsname, const char *hexsl);
+extern boolean_t zfs_is_readonly(zfs_sb_t *zsb);
extern int zfs_register_callbacks(zfs_sb_t *zsb);
extern void zfs_unregister_callbacks(zfs_sb_t *zsb);
extern int zfs_remount(struct super_block *sb, int *flags, char *data);
extern int zfs_root(zfs_sb_t *zsb, struct inode **ipp);
extern int zfs_statvfs(struct dentry *dentry, struct kstatfs *statp);
-extern int zfs_vget(struct vfsmount *vfsp, struct inode **ipp, fid_t *fidp);
+extern int zfs_vget(struct super_block *sb, struct inode **ipp, fid_t *fidp);
#ifdef __cplusplus
}
*/
#define ZTOI(znode) (&((znode)->z_inode))
#define ITOZ(inode) (container_of((inode), znode_t, z_inode))
-#define VTOZSB(vfs) ((zfs_sb_t *)((vfs)->mnt_sb->s_fs_info))
-#define ZTOZSB(znode) ((zfs_sb_t *)(ZTOI(znode)->i_sb->s_fs_info))
-#define ITOZSB(inode) ((zfs_sb_t *)((inode)->i_sb->s_fs_info))
+#define ZTOZSB(znode) ((zfs_sb_t *)(ZTOI(znode)->i_sb->s_fs_info))
+#define ITOZSB(inode) ((zfs_sb_t *)((inode)->i_sb->s_fs_info))
#define S_ISDEV(mode) (S_ISCHR(mode) || S_ISBLK(mode) || S_ISFIFO(mode))
#define CONTENT_MODIFIED (ATTR_MTIME | ATTR_CTIME)
#define ZFS_ACCESSTIME_STAMP(zsb, zp) \
- if ((zsb)->z_atime && !((zsb)->z_vfs->mnt_flags & MNT_READONLY)) \
+ if ((zsb)->z_atime && !(zfs_is_readonly(zsb))) \
zfs_tstamp_update_setup(zp, ACCESSED, NULL, NULL, B_FALSE);
extern int zfs_init_fs(zfs_sb_t *, znode_t **);
typedef struct zpl_mount_data {
const char *z_osname; /* Dataset name */
void *z_data; /* Mount options string */
- struct vfsmount *z_vfs; /* VFS mount point */
} zpl_mount_data_t;
extern const struct super_operations zpl_super_operations;
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
#define MNTOPT_LOUD "loud" /* verbose mount */
#define MNTOPT_BIND "bind" /* remount part of a tree */
#define MNTOPT_RBIND "rbind" /* include subtrees */
-#define MNTOPT_XATTR "user_xattr" /* enable extended attributes */
-#define MNTOPT_NOXATTR "nouser_xattr" /* disable extended attributes */
+#define MNTOPT_XATTR "xattr" /* enable extended attributes */
+#define MNTOPT_NOXATTR "noxattr" /* disable extended attributes */
#define MNTOPT_COMMENT "comment" /* comment */
#define MNTOPT_ZFSUTIL "zfsutil" /* called by zfs utility */
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
}
}
+static boolean_t
+zfs_is_namespace_prop(zfs_prop_t prop)
+{
+ switch (prop) {
+
+ case ZFS_PROP_ATIME:
+ case ZFS_PROP_DEVICES:
+ case ZFS_PROP_EXEC:
+ case ZFS_PROP_SETUID:
+ case ZFS_PROP_READONLY:
+ case ZFS_PROP_XATTR:
+ case ZFS_PROP_NBMAND:
+ return (B_TRUE);
+
+ default:
+ return (B_FALSE);
+ }
+}
+
/*
* Given a property name and value, set the property for the given dataset.
*/
if (do_prefix)
ret = changelist_postfix(cl);
- /*
- * Refresh the statistics so the new property value
- * is reflected.
- */
- if (ret == 0)
+ if (ret == 0) {
+ /*
+ * Refresh the statistics so the new property
+ * value is reflected.
+ */
(void) get_stats(zhp);
+
+ /*
+ * Remount the filesystem to propagate the change
+ * if one of the options handled by the generic
+ * Linux namespace layer has been modified.
+ */
+ if (zfs_is_namespace_prop(prop) &&
+ zfs_is_mounted(zhp, NULL))
+ ret = zfs_mount(zhp, MNTOPT_REMOUNT, 0);
+ }
}
error:
* True DSL properties are stored in an nvlist. The following two functions
* extract them appropriately.
*/
-static uint64_t
+uint64_t
getprop_uint64(zfs_handle_t *zhp, zfs_prop_t prop, char **source)
{
nvlist_t *nv;
return (rc ? EINVAL : 0);
}
+static int
+zfs_add_option(zfs_handle_t *zhp, char *options, int len,
+ zfs_prop_t prop, char *on, char *off)
+{
+ char *source;
+ uint64_t value;
+
+ /* Skip adding duplicate default options */
+ if ((strstr(options, on) != NULL) || (strstr(options, off) != NULL))
+ return (0);
+
+ /*
+ * zfs_prop_get_int() to not used to ensure our mount options
+ * are not influenced by the current /etc/mtab contents.
+ */
+ value = getprop_uint64(zhp, prop, &source);
+
+ (void) strlcat(options, ",", len);
+ (void) strlcat(options, value ? on : off, len);
+
+ return (0);
+}
+
+static int
+zfs_add_options(zfs_handle_t *zhp, char *options, int len)
+{
+ int error = 0;
+
+ error = zfs_add_option(zhp, options, len,
+ ZFS_PROP_ATIME, MNTOPT_ATIME, MNTOPT_NOATIME);
+ error = error ? error : zfs_add_option(zhp, options, len,
+ ZFS_PROP_DEVICES, MNTOPT_DEVICES, MNTOPT_NODEVICES);
+ error = error ? error : zfs_add_option(zhp, options, len,
+ ZFS_PROP_EXEC, MNTOPT_EXEC, MNTOPT_NOEXEC);
+ error = error ? error : zfs_add_option(zhp, options, len,
+ ZFS_PROP_READONLY, MNTOPT_RO, MNTOPT_RW);
+ error = error ? error : zfs_add_option(zhp, options, len,
+ ZFS_PROP_SETUID, MNTOPT_SETUID, MNTOPT_NOSETUID);
+ error = error ? error : zfs_add_option(zhp, options, len,
+ ZFS_PROP_XATTR, MNTOPT_XATTR, MNTOPT_NOXATTR);
+ error = error ? error : zfs_add_option(zhp, options, len,
+ ZFS_PROP_NBMAND, MNTOPT_NBMAND, MNTOPT_NONBMAND);
+
+ return (error);
+}
+
/*
* Mount the given filesystem.
*/
char mountpoint[ZFS_MAXPROPLEN];
char mntopts[MNT_LINE_MAX];
libzfs_handle_t *hdl = zhp->zfs_hdl;
- int rc;
+ int remount = 0, rc;
- if (options == NULL)
+ if (options == NULL) {
(void) strlcpy(mntopts, MNTOPT_DEFAULTS, sizeof (mntopts));
- else
+ } else {
(void) strlcpy(mntopts, options, sizeof (mntopts));
+ }
+
+ if (strstr(mntopts, MNTOPT_REMOUNT) != NULL)
+ remount = 1;
/*
* If the pool is imported read-only then all mounts must be read-only
if (zpool_get_prop_int(zhp->zpool_hdl, ZPOOL_PROP_READONLY, NULL))
(void) strlcat(mntopts, "," MNTOPT_RO, sizeof (mntopts));
+ /*
+ * Append default mount options which apply to the mount point.
+ * This is done because under Linux (unlike Solaris) multiple mount
+ * points may reference a single super block. This means that just
+ * given a super block there is no back reference to update the per
+ * mount point options.
+ */
+ rc = zfs_add_options(zhp, mntopts, sizeof (mntopts));
+ if (rc) {
+ zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
+ "default options unavailable"));
+ return (zfs_error_fmt(hdl, EZFS_MOUNTFAILED,
+ dgettext(TEXT_DOMAIN, "cannot mount '%s'"),
+ mountpoint));
+ }
+
/*
* Append zfsutil option so the mount helper allow the mount
*/
* Determine if the mountpoint is empty. If so, refuse to perform the
* mount. We don't perform this check if 'remount' is specified.
*/
- if (strstr(mntopts, MNTOPT_REMOUNT) == NULL &&
- !dir_is_empty(mountpoint)) {
+ if (!remount && !dir_is_empty(mountpoint)) {
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"directory is not empty"));
return (zfs_error_fmt(hdl, EZFS_MOUNTFAILED,
zhp->zfs_name));
}
+ /* remove the mounted entry before re-adding on remount */
+ if (remount)
+ libzfs_mnttab_remove(hdl, zhp->zfs_name);
+
/* add the mounted entry into our cache */
libzfs_mnttab_add(hdl, zfs_get_name(zhp), mountpoint, mntopts);
return (0);
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
static int
zfs_zaccess_dataset_check(znode_t *zp, uint32_t v4_mode)
{
- if ((v4_mode & WRITE_MASK) &&
- (ZTOZSB(zp)->z_vfs->mnt_flags & MNT_READONLY) &&
+ if ((v4_mode & WRITE_MASK) && (zfs_is_readonly(ZTOZSB(zp))) &&
(!S_ISDEV(ZTOI(zp)->i_mode) ||
(S_ISDEV(ZTOI(zp)->i_mode) && (v4_mode & WRITE_MASK_ATTRS)))) {
return (EROFS);
return (ENOENT);
}
- if (zsb->z_vfs->mnt_flags & MNT_READONLY) {
+ if (zfs_is_readonly(zsb)) {
zfs_dirent_unlock(dl);
return (EROFS);
}
mutex_enter(&os->os_user_ptr_lock);
*zsbp = dmu_objset_get_user(os);
- if (*zsbp) {
- mntget((*zsbp)->z_vfs);
+ if (*zsbp && (*zsbp)->z_sb) {
+ if (atomic_inc_not_zero(&((*zsbp)->z_sb->s_active)))
+ error = ESRCH;
} else {
error = ESRCH;
}
/*
* Find a zfs_sb_t for a mounted filesystem, or create our own, in which
- * case its z_vfs will be NULL, and it will be opened as the owner.
+ * case its z_sb will be NULL, and it will be opened as the owner.
*/
static int
zfs_sb_hold(const char *name, void *tag, zfs_sb_t **zsbp, boolean_t writer)
{
rrw_exit(&zsb->z_teardown_lock, tag);
- if (zsb->z_vfs) {
- mntput(zsb->z_vfs);
+ if (zsb->z_sb) {
+ deactivate_super(zsb->z_sb);
} else {
dmu_objset_disown(zsb->z_os, zsb);
zfs_sb_free(zsb);
resume_err = zfs_resume_fs(zsb, zc->zc_name);
error = error ? error : resume_err;
}
- mntput(zsb->z_vfs);
+ deactivate_super(zsb->z_sb);
} else {
if (dsl_dataset_tryown(ds, B_FALSE, FTAG)) {
error = dsl_dataset_clone_swap(clone, ds, B_TRUE);
if (error == 0)
error = zfs_resume_fs(zsb, tofs);
error = error ? error : end_err;
- mntput(zsb->z_vfs);
+ deactivate_super(zsb->z_sb);
} else {
error = dmu_recv_end(&drc);
}
}
if (error == 0)
error = dmu_objset_userspace_upgrade(zsb->z_os);
- mntput(zsb->z_vfs);
+ deactivate_super(zsb->z_sb);
} else {
/* XXX kind of reading contents without owning */
error = dmu_objset_hold(zc->zc_name, FTAG, &os);
}
EXPORT_SYMBOL(zfs_sync);
+boolean_t
+zfs_is_readonly(zfs_sb_t *zsb)
+{
+ return (!!(zsb->z_sb->s_flags & MS_RDONLY));
+}
+EXPORT_SYMBOL(zfs_is_readonly);
+
static void
atime_changed_cb(void *arg, uint64_t newval)
{
- zfs_sb_t *zsb = arg;
- struct super_block *sb = zsb->z_sb;
- struct vfsmount *vfs = zsb->z_vfs;
-
- if (newval == TRUE) {
- vfs->mnt_flags &= ~MNT_NOATIME;
- sb->s_flags &= ~MS_NOATIME;
- zsb->z_atime = TRUE;
- } else {
- vfs->mnt_flags |= MNT_NOATIME;
- sb->s_flags |= MS_NOATIME;
- zsb->z_atime = FALSE;
- }
+ ((zfs_sb_t *)arg)->z_atime = newval;
}
static void
{
zfs_sb_t *zsb = arg;
- if (newval == TRUE) {
- zsb->z_flags |= ZSB_XATTR_USER;
- } else {
- zsb->z_flags &= ~ZSB_XATTR_USER;
- }
+ if (newval == TRUE)
+ zsb->z_flags |= ZSB_XATTR;
+ else
+ zsb->z_flags &= ~ZSB_XATTR;
}
static void
{
zfs_sb_t *zsb = arg;
struct super_block *sb = zsb->z_sb;
- struct vfsmount *vfs = zsb->z_vfs;
- if (newval) {
- vfs->mnt_flags |= MNT_READONLY;
+ if (sb == NULL)
+ return;
+
+ if (newval)
sb->s_flags |= MS_RDONLY;
- } else {
- vfs->mnt_flags &= ~MNT_READONLY;
+ else
sb->s_flags &= ~MS_RDONLY;
- }
}
static void
devices_changed_cb(void *arg, uint64_t newval)
{
- zfs_sb_t *zsb = arg;
- struct super_block *sb = zsb->z_sb;
- struct vfsmount *vfs = zsb->z_vfs;
-
- if (newval == FALSE) {
- vfs->mnt_flags |= MNT_NODEV;
- sb->s_flags |= MS_NODEV;
- } else {
- vfs->mnt_flags &= ~MNT_NODEV;
- sb->s_flags &= ~MS_NODEV;
- }
}
static void
setuid_changed_cb(void *arg, uint64_t newval)
{
- zfs_sb_t *zsb = arg;
- struct super_block *sb = zsb->z_sb;
- struct vfsmount *vfs = zsb->z_vfs;
-
- if (newval == FALSE) {
- vfs->mnt_flags |= MNT_NOSUID;
- sb->s_flags |= MS_NOSUID;
- } else {
- vfs->mnt_flags &= ~MNT_NOSUID;
- sb->s_flags &= ~MS_NOSUID;
- }
}
static void
exec_changed_cb(void *arg, uint64_t newval)
{
- zfs_sb_t *zsb = arg;
- struct super_block *sb = zsb->z_sb;
- struct vfsmount *vfs = zsb->z_vfs;
-
- if (newval == FALSE) {
- vfs->mnt_flags |= MNT_NOEXEC;
- sb->s_flags |= MS_NOEXEC;
- } else {
- vfs->mnt_flags &= ~MNT_NOEXEC;
- sb->s_flags &= ~MS_NOEXEC;
- }
}
-/*
- * The nbmand mount option can be changed at mount time.
- * We can't allow it to be toggled on live file systems or incorrect
- * behavior may be seen from cifs clients
- *
- * This property isn't registered via dsl_prop_register(), but this callback
- * will be called when a file system is first mounted
- */
static void
nbmand_changed_cb(void *arg, uint64_t newval)
{
zfs_sb_t *zsb = arg;
struct super_block *sb = zsb->z_sb;
- if (newval == TRUE) {
+ if (sb == NULL)
+ return;
+
+ if (newval == TRUE)
sb->s_flags |= MS_MANDLOCK;
- } else {
+ else
sb->s_flags &= ~MS_MANDLOCK;
- }
}
static void
int
zfs_register_callbacks(zfs_sb_t *zsb)
{
- struct vfsmount *vfsp = zsb->z_vfs;
struct dsl_dataset *ds = NULL;
objset_t *os = zsb->z_os;
- uint64_t nbmand;
- boolean_t readonly = B_FALSE;
- boolean_t setuid = B_TRUE;
- boolean_t exec = B_TRUE;
- boolean_t devices = B_TRUE;
- boolean_t xattr = B_TRUE;
- boolean_t atime = B_TRUE;
- char osname[MAXNAMELEN];
int error = 0;
- /*
- * While Linux allows multiple vfs mounts per super block we have
- * limited it artificially to one in zfs_fill_super. Thus it is
- * safe for us to modify the vfs mount fails through the callbacks.
- */
- if ((vfsp->mnt_flags & MNT_READONLY) ||
- !spa_writeable(dmu_objset_spa(os)))
- readonly = B_TRUE;
-
- if (vfsp->mnt_flags & MNT_NOSUID) {
- devices = B_FALSE;
- setuid = B_FALSE;
- } else {
- if (vfsp->mnt_flags & MNT_NODEV)
- devices = B_FALSE;
- }
-
- if (vfsp->mnt_flags & MNT_NOEXEC)
- exec = B_FALSE;
-
- if (vfsp->mnt_flags & MNT_NOATIME)
- atime = B_FALSE;
-
- /*
- * nbmand is a special property which may only be changed at
- * mount time. Unfortunately, Linux does not have a VFS mount
- * flag instead this is a super block flag. So setting this
- * option at mount time will have to wait until we can parse
- * the mount option string. For now we rely on the nbmand
- * value stored with the object set. Additional mount option
- * string to be handled:
- *
- * case: sensitive|insensitive|mixed
- * zerocopy: on|off
- */
-
- dmu_objset_name(os, osname);
- if ((error = dsl_prop_get_integer(osname, "nbmand", &nbmand, NULL)))
- return (error);
+ if (zfs_is_readonly(zsb) || !spa_writeable(dmu_objset_spa(os)))
+ readonly_changed_cb(zsb, B_TRUE);
/*
* Register property callbacks.
"aclinherit", acl_inherit_changed_cb, zsb);
error = error ? error : dsl_prop_register(ds,
"vscan", vscan_changed_cb, zsb);
+ error = error ? error : dsl_prop_register(ds,
+ "nbmand", nbmand_changed_cb, zsb);
if (error)
goto unregister;
- /*
- * Invoke our callbacks to set required flags.
- */
- readonly_changed_cb(zsb, readonly);
- setuid_changed_cb(zsb, setuid);
- exec_changed_cb(zsb, exec);
- devices_changed_cb(zsb, devices);
- xattr_changed_cb(zsb, xattr);
- atime_changed_cb(zsb, atime);
- nbmand_changed_cb(zsb, nbmand);
-
return (0);
unregister:
(void) dsl_prop_unregister(ds, "aclinherit", acl_inherit_changed_cb,
zsb);
(void) dsl_prop_unregister(ds, "vscan", vscan_changed_cb, zsb);
+ (void) dsl_prop_unregister(ds, "nbmand", nbmand_changed_cb, zsb);
return (error);
}
* Should probably make this a kmem cache, shuffle fields,
* and just bzero up to z_hold_mtx[].
*/
- zsb->z_vfs = NULL;
+ zsb->z_sb = NULL;
zsb->z_parent = zsb;
zsb->z_max_blksz = SPA_MAXBLOCKSIZE;
zsb->z_show_ctldir = ZFS_SNAPDIR_VISIBLE;
* During replay we remove the read only flag to
* allow replays to succeed.
*/
- readonly = zsb->z_vfs->mnt_flags & MNT_READONLY;
+ readonly = zfs_is_readonly(zsb);
if (readonly != 0)
- zsb->z_vfs->mnt_flags &= ~MNT_READONLY;
+ readonly_changed_cb(zsb, B_FALSE);
else
zfs_unlinked_drain(zsb);
zsb->z_replay = B_FALSE;
}
}
- zsb->z_vfs->mnt_flags |= readonly; /* restore readonly bit */
+
+ /* restore readonly bit */
+ if (readonly != 0)
+ readonly_changed_cb(zsb, B_TRUE);
}
return (0);
VERIFY(dsl_prop_unregister(ds, "vscan",
vscan_changed_cb, zsb) == 0);
+
+ VERIFY(dsl_prop_unregister(ds, "nbmand",
+ nbmand_changed_cb, zsb) == 0);
}
}
EXPORT_SYMBOL(zfs_unregister_callbacks);
* Evict cached data
*/
if (dmu_objset_is_dirty_anywhere(zsb->z_os))
- if (!(zsb->z_vfs->mnt_flags & MNT_READONLY))
+ if (!zfs_is_readonly(zsb))
txg_wait_synced(dmu_objset_pool(zsb->z_os), 0);
(void) dmu_objset_evict_dbufs(zsb->z_os);
uint64_t recordsize;
int error;
- /*
- * Linux allows multiple vfs mounts per super block. However, the
- * zfs_sb_t only contains a pointer for a single vfs mount. This
- * back reference in the long term could be extended to a list of
- * vfs mounts if a hook were added to the kernel to notify us when
- * a vfsmount is destroyed. Until then we must limit the number
- * of mounts per super block to one.
- */
- if (atomic_read(&sb->s_active) > 1)
- return (EBUSY);
-
error = zfs_sb_create(osname, &zsb);
if (error)
return (error);
goto out;
zsb->z_sb = sb;
- zsb->z_vfs = zmd->z_vfs;
sb->s_fs_info = zsb;
sb->s_magic = ZFS_SUPER_MAGIC;
sb->s_maxbytes = MAX_LFS_FILESIZE;
int
zfs_remount(struct super_block *sb, int *flags, char *data)
{
- zfs_sb_t *zsb = sb->s_fs_info;
- boolean_t readonly = B_FALSE;
- boolean_t setuid = B_TRUE;
- boolean_t exec = B_TRUE;
- boolean_t devices = B_TRUE;
- boolean_t atime = B_TRUE;
-
- if (*flags & MS_RDONLY)
- readonly = B_TRUE;
-
- if (*flags & MS_NOSUID) {
- devices = B_FALSE;
- setuid = B_FALSE;
- } else {
- if (*flags & MS_NODEV)
- devices = B_FALSE;
- }
-
- if (*flags & MS_NOEXEC)
- exec = B_FALSE;
-
- if (*flags & MS_NOATIME)
- atime = B_FALSE;
-
/*
- * Invoke our callbacks to set required flags.
+ * All namespace flags (MNT_*) and super block flags (MS_*) will
+ * be handled by the Linux VFS. Only handle custom options here.
*/
- readonly_changed_cb(zsb, readonly);
- setuid_changed_cb(zsb, setuid);
- exec_changed_cb(zsb, exec);
- devices_changed_cb(zsb, devices);
- atime_changed_cb(zsb, atime);
-
return (0);
}
EXPORT_SYMBOL(zfs_remount);
int
-zfs_vget(struct vfsmount *vfsp, struct inode **ipp, fid_t *fidp)
+zfs_vget(struct super_block *sb, struct inode **ipp, fid_t *fidp)
{
- zfs_sb_t *zsb = VTOZSB(vfsp);
+ zfs_sb_t *zsb = sb->s_fs_info;
znode_t *zp;
uint64_t object = 0;
uint64_t fid_gen = 0;
/*
* If the xattr property is off, refuse the lookup request.
*/
- if (!(zsb->z_flags & ZSB_XATTR_USER)) {
+ if (!(zsb->z_flags & ZSB_XATTR)) {
ZFS_EXIT(zsb);
return (EINVAL);
}
aclp = NULL;
/* Can this be moved to before the top label? */
- if (zsb->z_vfs->mnt_flags & MNT_READONLY) {
+ if (zfs_is_readonly(zsb)) {
err = EROFS;
goto out3;
}
zpl_fh_to_dentry(struct super_block *sb, struct fid *fh,
int fh_len, int fh_type)
{
- zfs_sb_t *zsb = sb->s_fs_info;
- struct vfsmount *vfs = zsb->z_vfs;
fid_t *fid = (fid_t *)fh;
struct inode *ip;
int len_bytes, rc;
len_bytes < offsetof(fid_t, fid_data) + fid->fid_len)
return ERR_PTR(-EINVAL);
- rc = zfs_vget(vfs, &ip, fid);
+ rc = zfs_vget(sb, &ip, fid);
if (rc != 0)
return ERR_PTR(-rc);
* MNT_NOSUID, MNT_NODEV, MNT_NOEXEC, MNT_NOATIME, MNT_READONLY
*/
- if (zsb->z_flags & ZSB_XATTR_USER)
- seq_printf(seq, ",%s", "xattr");
+ seq_printf(seq, ",%s", zsb->z_flags & ZSB_XATTR ? "xattr" : "noxattr");
return (0);
}
return (error);
}
+#ifdef HAVE_MOUNT_NODEV
+static struct dentry *
+zpl_mount(struct file_system_type *fs_type, int flags,
+ const char *osname, void *data)
+{
+ zpl_mount_data_t zmd = { osname, data };
+
+ return mount_nodev(fs_type, flags, &zmd, zpl_fill_super);
+}
+#else
static int
zpl_get_sb(struct file_system_type *fs_type, int flags,
const char *osname, void *data, struct vfsmount *mnt)
{
- zpl_mount_data_t zmd = { osname, data, mnt };
+ zpl_mount_data_t zmd = { osname, data };
return get_sb_nodev(fs_type, flags, &zmd, zpl_fill_super, mnt);
}
+#endif /* HAVE_MOUNT_NODEV */
static void
zpl_kill_sb(struct super_block *sb)
struct file_system_type zpl_fs_type = {
.owner = THIS_MODULE,
.name = ZFS_DRIVER,
+#ifdef HAVE_MOUNT_NODEV
+ .mount = zpl_mount,
+#else
.get_sb = zpl_get_sb,
+#endif /* HAVE_MOUNT_NODEV */
.kill_sb = zpl_kill_sb,
};
xattr_filldir_t *xf = arg;
if (!strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN))
- if (!(ITOZSB(xf->inode)->z_flags & ZSB_XATTR_USER))
+ if (!(ITOZSB(xf->inode)->z_flags & ZSB_XATTR))
return (0);
if (!strncmp(name, XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN))
if (strcmp(name, "") == 0)
return -EINVAL;
- if (!(ITOZSB(ip)->z_flags & ZSB_XATTR_USER))
+ if (!(ITOZSB(ip)->z_flags & ZSB_XATTR))
return -EOPNOTSUPP;
xattr_name = kmem_asprintf("%s%s", XATTR_USER_PREFIX, name);
if (strcmp(name, "") == 0)
return -EINVAL;
- if (!(ITOZSB(ip)->z_flags & ZSB_XATTR_USER))
+ if (!(ITOZSB(ip)->z_flags & ZSB_XATTR))
return -EOPNOTSUPP;
xattr_name = kmem_asprintf("%s%s", XATTR_USER_PREFIX, name);
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
+ $(top_srcdir)/config/kernel-mount-nodev.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
+/* mount_nodev() is available */
+#undef HAVE_MOUNT_NODEV
+
/* open_bdev_exclusive() is available */
#undef HAVE_OPEN_BDEV_EXCLUSIVE