diff options
author | Brian Behlendorf <[email protected]> | 2011-05-19 11:44:07 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2011-07-01 13:36:39 -0700 |
commit | 2cf7f52bc42f215d4ef27d0fd75fc1b1417cb841 (patch) | |
tree | 3b30ae22546bd09968cff08c7a41bb9e791ea91d /include | |
parent | 5c03efc379693f992ebe39c6a00c7297c4a304ea (diff) |
Linux compat 2.6.39: mount_nodev()
The .get_sb callback has been replaced by a .mount callback
in the file_system_type structure. When using the new
interface the caller must now use the mount_nodev() helper.
Unfortunately, the new interface no longer passes the vfsmount
down to the zfs layers. This poses a problem for the existing
implementation because we currently save this pointer in the
super block for latter use. It provides our only entry point
in to the namespace layer for manipulating certain mount options.
This needed to be done originally to allow commands like
'zfs set atime=off tank' to work properly. It also allowed me
to keep more of the original Solaris code unmodified. Under
Solaris there is a 1-to-1 mapping between a mount point and a
file system so this is a fairly natural thing to do. However,
under Linux they many be multiple entries in the namespace
which reference the same filesystem. Thus keeping a back
reference from the filesystem to the namespace is complicated.
Rather than introduce some ugly hack to get the vfsmount and
continue as before. I'm leveraging this API change to update
the ZFS code to do things in a more natural way for Linux.
This has the upside that is resolves the compatibility issue
for the long term and fixes several other minor bugs which
have been reported.
This commit updates the code to remove this vfsmount back
reference entirely. All modifications to filesystem mount
options are now passed in to the kernel via a '-o remount'.
This is the expected Linux mechanism and allows the namespace
to properly handle any options which apply to it before passing
them on to the file system itself.
Aside from fixing the compatibility issue, removing the
vfsmount has had the benefit of simplifying the code. This
change which fairly involved has turned out nicely.
Closes #246
Closes #217
Closes #187
Closes #248
Closes #231
Diffstat (limited to 'include')
-rw-r--r-- | include/Makefile.in | 1 | ||||
-rw-r--r-- | include/libzfs.h | 1 | ||||
-rw-r--r-- | include/linux/Makefile.in | 1 | ||||
-rw-r--r-- | include/sys/Makefile.in | 1 | ||||
-rw-r--r-- | include/sys/fm/Makefile.in | 1 | ||||
-rw-r--r-- | include/sys/fm/fs/Makefile.in | 1 | ||||
-rw-r--r-- | include/sys/fs/Makefile.in | 1 | ||||
-rw-r--r-- | include/sys/zfs_vfsops.h | 6 | ||||
-rw-r--r-- | include/sys/zfs_znode.h | 7 | ||||
-rw-r--r-- | include/sys/zpl.h | 1 |
10 files changed, 13 insertions, 8 deletions
diff --git a/include/Makefile.in b/include/Makefile.in index d1533b75e..ddb20fcb9 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -63,6 +63,7 @@ am__aclocal_m4_deps = \ $(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 \ diff --git a/include/libzfs.h b/include/libzfs.h index e0c695043..23422b2c9 100644 --- a/include/libzfs.h +++ b/include/libzfs.h @@ -436,6 +436,7 @@ extern int zfs_prop_get_userquota_int(zfs_handle_t *zhp, const char *propname, 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); diff --git a/include/linux/Makefile.in b/include/linux/Makefile.in index 269613190..631aade30 100644 --- a/include/linux/Makefile.in +++ b/include/linux/Makefile.in @@ -63,6 +63,7 @@ am__aclocal_m4_deps = \ $(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 \ diff --git a/include/sys/Makefile.in b/include/sys/Makefile.in index 85f73afdc..954728cc8 100644 --- a/include/sys/Makefile.in +++ b/include/sys/Makefile.in @@ -63,6 +63,7 @@ am__aclocal_m4_deps = \ $(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 \ diff --git a/include/sys/fm/Makefile.in b/include/sys/fm/Makefile.in index 00f3f9f69..05de923fb 100644 --- a/include/sys/fm/Makefile.in +++ b/include/sys/fm/Makefile.in @@ -63,6 +63,7 @@ am__aclocal_m4_deps = \ $(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 \ diff --git a/include/sys/fm/fs/Makefile.in b/include/sys/fm/fs/Makefile.in index 3aa7c3e87..66b516bb2 100644 --- a/include/sys/fm/fs/Makefile.in +++ b/include/sys/fm/fs/Makefile.in @@ -63,6 +63,7 @@ am__aclocal_m4_deps = \ $(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 \ diff --git a/include/sys/fs/Makefile.in b/include/sys/fs/Makefile.in index bf7f57e4e..ef905a718 100644 --- a/include/sys/fs/Makefile.in +++ b/include/sys/fs/Makefile.in @@ -63,6 +63,7 @@ am__aclocal_m4_deps = \ $(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 \ diff --git a/include/sys/zfs_vfsops.h b/include/sys/zfs_vfsops.h index 7622f0308..ae5f811c0 100644 --- a/include/sys/zfs_vfsops.h +++ b/include/sys/zfs_vfsops.h @@ -42,7 +42,6 @@ struct zfs_sb; 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 */ @@ -89,7 +88,7 @@ typedef struct zfs_sb { #define ZFS_SUPER_MAGIC 0x2fc12fc1 -#define ZSB_XATTR_USER 0x0001 /* Enable user xattrs */ +#define ZSB_XATTR 0x0001 /* Enable user xattrs */ /* @@ -182,6 +181,7 @@ extern int zfs_set_version(zfs_sb_t *zsb, uint64_t newvers); 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); @@ -190,7 +190,7 @@ extern int zfs_umount(struct super_block *sb); 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 } diff --git a/include/sys/zfs_znode.h b/include/sys/zfs_znode.h index 2f9ca743d..6a0c6a4df 100644 --- a/include/sys/zfs_znode.h +++ b/include/sys/zfs_znode.h @@ -236,9 +236,8 @@ typedef struct znode { */ #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)) @@ -306,7 +305,7 @@ typedef struct znode { #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 **); diff --git a/include/sys/zpl.h b/include/sys/zpl.h index 2770e59b2..0aacce8bd 100644 --- a/include/sys/zpl.h +++ b/include/sys/zpl.h @@ -51,7 +51,6 @@ extern const struct file_operations zpl_dir_file_operations; 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; |