diff --git a/config/kernel-create-nameidata.m4 b/config/kernel-create-nameidata.m4 new file mode 100644 index 000000000..100f07761 --- /dev/null +++ b/config/kernel-create-nameidata.m4 @@ -0,0 +1,26 @@ +dnl # +dnl # 3.6 API change +dnl # +AC_DEFUN([ZFS_AC_KERNEL_CREATE_NAMEIDATA], [ + AC_MSG_CHECKING([whether iops->create() takes struct nameidata]) + ZFS_LINUX_TRY_COMPILE([ + #include + ],[ + #ifdef HAVE_MKDIR_UMODE_T + int (*inode_create) (struct inode *,struct dentry *, + umode_t, struct nameidata *) = NULL; + #else + int (*inode_create) (struct inode *,struct dentry *, + int, struct nameidata *) = NULL; + #endif + struct inode_operations iops __attribute__ ((unused)) = { + .create = inode_create, + }; + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_CREATE_NAMEIDATA, 1, + [iops->create() operation takes nameidata]) + ],[ + AC_MSG_RESULT(no) + ]) +]) diff --git a/config/kernel-lookup-nameidata.m4 b/config/kernel-lookup-nameidata.m4 new file mode 100644 index 000000000..5e30be433 --- /dev/null +++ b/config/kernel-lookup-nameidata.m4 @@ -0,0 +1,21 @@ +dnl # +dnl # 3.6 API change +dnl # +AC_DEFUN([ZFS_AC_KERNEL_LOOKUP_NAMEIDATA], [ + AC_MSG_CHECKING([whether iops->lookup() takes struct nameidata]) + ZFS_LINUX_TRY_COMPILE([ + #include + ],[ + struct dentry * (*inode_lookup) (struct inode *,struct dentry *, + struct nameidata *) = NULL; + struct inode_operations iops __attribute__ ((unused)) = { + .lookup = inode_lookup, + }; + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_LOOKUP_NAMEIDATA, 1, + [iops->lookup() operation takes nameidata]) + ],[ + AC_MSG_RESULT(no) + ]) +]) diff --git a/config/kernel-create-umode-t.m4 b/config/kernel-mkdir-umode-t.m4 similarity index 77% rename from config/kernel-create-umode-t.m4 rename to config/kernel-mkdir-umode-t.m4 index f88113f40..dd5d94ba9 100644 --- a/config/kernel-create-umode-t.m4 +++ b/config/kernel-mkdir-umode-t.m4 @@ -6,19 +6,18 @@ dnl # would also change all three prototypes. However, if it turns out that dnl # some distribution doesn't backport the whole thing this could be dnl # broken apart in to three seperate checks. dnl # -AC_DEFUN([ZFS_AC_KERNEL_CREATE_UMODE_T], [ +AC_DEFUN([ZFS_AC_KERNEL_MKDIR_UMODE_T], [ AC_MSG_CHECKING([whether iops->create()/mkdir()/mknod() take umode_t]) ZFS_LINUX_TRY_COMPILE([ #include ],[ - int (*create) (struct inode *, struct dentry *, umode_t, - struct nameidata *) = NULL; + int (*mkdir) (struct inode *,struct dentry *,umode_t) = NULL; struct inode_operations iops __attribute__ ((unused)) = { - .create = create, + .mkdir = mkdir, }; ],[ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_CREATE_UMODE_T, 1, + AC_DEFINE(HAVE_MKDIR_UMODE_T, 1, [iops->create()/mkdir()/mknod() take umode_t]) ],[ AC_MSG_RESULT(no) diff --git a/config/kernel-sget-args.m4 b/config/kernel-sget-args.m4 new file mode 100644 index 000000000..9d1745925 --- /dev/null +++ b/config/kernel-sget-args.m4 @@ -0,0 +1,23 @@ +dnl # +dnl # 3.6 API change, +dnl # 'sget' now takes the mount flags as an argument. +dnl # +AC_DEFUN([ZFS_AC_KERNEL_5ARG_SGET], + [AC_MSG_CHECKING([whether sget() wants 5 args]) + ZFS_LINUX_TRY_COMPILE([ + #include + ],[ + struct file_system_type *type = NULL; + int (*test)(struct super_block *,void *) = NULL; + int (*set)(struct super_block *,void *) = NULL; + int flags = 0; + void *data = NULL; + (void) sget(type, test, set, flags, data); + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_5ARG_SGET, 1, [sget() wants 5 args]) + ],[ + AC_MSG_RESULT(no) + ]) +]) + diff --git a/config/kernel.m4 b/config/kernel.m4 index 89b0a9806..13238d8ac 100644 --- a/config/kernel.m4 +++ b/config/kernel.m4 @@ -49,8 +49,10 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [ ZFS_AC_KERNEL_NR_CACHED_OBJECTS ZFS_AC_KERNEL_FREE_CACHED_OBJECTS ZFS_AC_KERNEL_FALLOCATE + ZFS_AC_KERNEL_MKDIR_UMODE_T + ZFS_AC_KERNEL_LOOKUP_NAMEIDATA + ZFS_AC_KERNEL_CREATE_NAMEIDATA ZFS_AC_KERNEL_TRUNCATE_RANGE - ZFS_AC_KERNEL_CREATE_UMODE_T ZFS_AC_KERNEL_AUTOMOUNT ZFS_AC_KERNEL_ENCODE_FH_WITH_INODE ZFS_AC_KERNEL_COMMIT_METADATA @@ -68,6 +70,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [ ZFS_AC_KERNEL_BDI_SETUP_AND_REGISTER ZFS_AC_KERNEL_SET_NLINK ZFS_AC_KERNEL_ELEVATOR_CHANGE + ZFS_AC_KERNEL_5ARG_SGET AS_IF([test "$LINUX_OBJ" != "$LINUX"], [ KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$LINUX_OBJ" diff --git a/include/linux/vfs_compat.h b/include/linux/vfs_compat.h index 9343f99a5..c4e1771ae 100644 --- a/include/linux/vfs_compat.h +++ b/include/linux/vfs_compat.h @@ -115,7 +115,7 @@ set_nlink(struct inode *inode, unsigned int nlink) * umode_t type rather than an int. To cleanly handle both definitions * the zpl_umode_t type is introduced and set accordingly. */ -#ifdef HAVE_CREATE_UMODE_T +#ifdef HAVE_MKDIR_UMODE_T typedef umode_t zpl_umode_t; #else typedef int zpl_umode_t; @@ -131,4 +131,14 @@ typedef int zpl_umode_t; #define clear_inode(ip) end_writeback(ip) #endif /* HAVE_EVICT_INODE && !HAVE_CLEAR_INODE */ +/* + * 3.6 API change, + * The sget() helper function now takes the mount flags as an argument. + */ +#ifdef HAVE_5ARG_SGET +#define zpl_sget(type, cmp, set, fl, mtd) sget(type, cmp, set, fl, mtd) +#else +#define zpl_sget(type, cmp, set, fl, mtd) sget(type, cmp, set, mtd) +#endif /* HAVE_5ARG_SGET */ + #endif /* _ZFS_VFS_H */ diff --git a/module/zfs/zfs_ctldir.c b/module/zfs/zfs_ctldir.c index c49d7172a..55d169654 100644 --- a/module/zfs/zfs_ctldir.c +++ b/module/zfs/zfs_ctldir.c @@ -920,8 +920,8 @@ zfsctl_lookup_objset(struct super_block *sb, uint64_t objsetid, zfs_sb_t **zsbp) * race cannot occur to an expired mount point because * we hold the zsb->z_ctldir_lock to prevent the race. */ - sbp = sget(&zpl_fs_type, zfsctl_test_super, - zfsctl_set_super, &id); + sbp = zpl_sget(&zpl_fs_type, zfsctl_test_super, + zfsctl_set_super, 0, &id); if (IS_ERR(sbp)) { error = -PTR_ERR(sbp); } else { diff --git a/module/zfs/zpl_ctldir.c b/module/zfs/zpl_ctldir.c index c680e5443..7dfaf6ebc 100644 --- a/module/zfs/zpl_ctldir.c +++ b/module/zfs/zpl_ctldir.c @@ -143,7 +143,11 @@ zpl_root_getattr(struct vfsmount *mnt, struct dentry *dentry, } static struct dentry * +#ifdef HAVE_LOOKUP_NAMEIDATA zpl_root_lookup(struct inode *dip, struct dentry *dentry, struct nameidata *nd) +#else +zpl_root_lookup(struct inode *dip, struct dentry *dentry, unsigned int flags) +#endif { cred_t *cr = CRED(); struct inode *ip; @@ -180,8 +184,14 @@ const struct inode_operations zpl_ops_root = { }; static struct dentry * +#ifdef HAVE_LOOKUP_NAMEIDATA zpl_snapdir_lookup(struct inode *dip, struct dentry *dentry, struct nameidata *nd) +#else +zpl_snapdir_lookup(struct inode *dip, struct dentry *dentry, + unsigned int flags) +#endif + { cred_t *cr = CRED(); struct inode *ip; @@ -410,8 +420,13 @@ const struct dentry_operations zpl_dops_snapdirs = { #endif /* HAVE_AUTOMOUNT */ static struct dentry * +#ifdef HAVE_LOOKUP_NAMEIDATA zpl_shares_lookup(struct inode *dip, struct dentry *dentry, struct nameidata *nd) +#else +zpl_shares_lookup(struct inode *dip, struct dentry *dentry, + unsigned int flags) +#endif { cred_t *cr = CRED(); struct inode *ip = NULL; diff --git a/module/zfs/zpl_inode.c b/module/zfs/zpl_inode.c index 0dab82cc0..bb389f837 100644 --- a/module/zfs/zpl_inode.c +++ b/module/zfs/zpl_inode.c @@ -31,7 +31,11 @@ static struct dentry * +#ifdef HAVE_LOOKUP_NAMEIDATA zpl_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd) +#else +zpl_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) +#endif { cred_t *cr = CRED(); struct inode *ip; @@ -71,8 +75,13 @@ zpl_vap_init(vattr_t *vap, struct inode *dir, struct dentry *dentry, } static int +#ifdef HAVE_CREATE_NAMEIDATA zpl_create(struct inode *dir, struct dentry *dentry, zpl_umode_t mode, struct nameidata *nd) +#else +zpl_create(struct inode *dir, struct dentry *dentry, zpl_umode_t mode, + bool flag) +#endif { cred_t *cr = CRED(); struct inode *ip; diff --git a/module/zfs/zpl_super.c b/module/zfs/zpl_super.c index 29d7f7dfb..fd4f691e1 100644 --- a/module/zfs/zpl_super.c +++ b/module/zfs/zpl_super.c @@ -316,7 +316,6 @@ const struct super_operations zpl_super_operations = { .delete_inode = zpl_inode_delete, #endif /* HAVE_EVICT_INODE */ .put_super = zpl_put_super, - .write_super = NULL, .sync_fs = zpl_sync_fs, .statfs = zpl_statfs, .remount_fs = zpl_remount_fs,