summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2013-03-14 10:43:46 -0700
committerBrian Behlendorf <[email protected]>2013-03-14 10:43:51 -0700
commit5c30c47a4542a58ae6c94bdee15f4691affa2a17 (patch)
tree9232c69f3970d4df5388c21dde29825aca1fa093
parentea5c4389fb7183f036b38e5ba171ac5a05798c4d (diff)
parent4a31e5aa9be561a450a2741f5305932e0b9df241 (diff)
Merge branch 'linux-3.9'
Signed-off-by: Brian Behlendorf <[email protected]> Closes #221
-rw-r--r--config/spl-build.m494
-rw-r--r--include/sys/sysmacros.h5
-rw-r--r--module/spl/spl-kmem.c3
-rw-r--r--module/spl/spl-tsd.c3
-rw-r--r--module/spl/spl-vnode.c66
5 files changed, 114 insertions, 57 deletions
diff --git a/config/spl-build.m4 b/config/spl-build.m4
index 3dcc05e65..14a7d9740 100644
--- a/config/spl-build.m4
+++ b/config/spl-build.m4
@@ -63,7 +63,7 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
SPL_AC_GET_ZONE_COUNTS
SPL_AC_USER_PATH_DIR
SPL_AC_SET_FS_PWD
- SPL_AC_2ARGS_SET_FS_PWD
+ SPL_AC_SET_FS_PWD_WITH_CONST
SPL_AC_2ARGS_VFS_UNLINK
SPL_AC_4ARGS_VFS_RENAME
SPL_AC_VFS_FSYNC
@@ -88,6 +88,8 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
SPL_AC_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE
SPL_AC_SHRINK_CONTROL_STRUCT
SPL_AC_RWSEM_SPINLOCK_IS_RAW
+ SPL_AC_SCHED_RT_HEADER
+ SPL_AC_2ARGS_VFS_GETATTR
])
AC_DEFUN([SPL_AC_MODULE_SYMVERS], [
@@ -1670,23 +1672,43 @@ AC_DEFUN([SPL_AC_SET_FS_PWD],
])
dnl #
-dnl # 2.6.25 API change,
-dnl # Simplied API by replacing mnt+dentry args with a single path arg.
+dnl # 3.9 API change
+dnl # set_fs_pwd takes const struct path *
dnl #
-AC_DEFUN([SPL_AC_2ARGS_SET_FS_PWD],
- [AC_MSG_CHECKING([whether set_fs_pwd() wants 2 args])
+AC_DEFUN([SPL_AC_SET_FS_PWD_WITH_CONST],
+ tmp_flags="$EXTRA_KCFLAGS"
+ EXTRA_KCFLAGS="-Werror"
+ [AC_MSG_CHECKING([whether set_fs_pwd() requires const struct path *])
SPL_LINUX_TRY_COMPILE([
- #include <linux/sched.h>
+ #include <linux/spinlock.h>
#include <linux/fs_struct.h>
+ #include <linux/path.h>
+ void (*const set_fs_pwd_func)
+ (struct fs_struct *, const struct path *)
+ = set_fs_pwd;
],[
- set_fs_pwd(NULL, NULL);
+ return 0;
],[
AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_2ARGS_SET_FS_PWD, 1,
- [set_fs_pwd() wants 2 args])
- ],[
- AC_MSG_RESULT(no)
+ AC_DEFINE(HAVE_SET_FS_PWD_WITH_CONST, 1,
+ [set_fs_pwd() needs const path *])
+ ],[
+ SPL_LINUX_TRY_COMPILE([
+ #include <linux/spinlock.h>
+ #include <linux/fs_struct.h>
+ #include <linux/path.h>
+ void (*const set_fs_pwd_func)
+ (struct fs_struct *, struct path *)
+ = set_fs_pwd;
+ ],[
+ return 0;
+ ],[
+ AC_MSG_RESULT(no)
+ ],[
+ AC_MSG_ERROR(unknown)
+ ])
])
+ EXTRA_KCFLAGS="$tmp_flags"
])
dnl #
@@ -2217,3 +2239,53 @@ AC_DEFUN([SPL_AC_RWSEM_SPINLOCK_IS_RAW], [
])
EXTRA_KCFLAGS="$tmp_flags"
])
+
+dnl #
+dnl # 3.9 API change,
+dnl # Moved things from linux/sched.h to linux/sched/rt.h
+dnl #
+AC_DEFUN([SPL_AC_SCHED_RT_HEADER],
+ [AC_MSG_CHECKING([whether header linux/sched/rt.h exists])
+ SPL_LINUX_TRY_COMPILE([
+ #include <linux/sched.h>
+ #include <linux/sched/rt.h>
+ ],[
+ return 0;
+ ],[
+ AC_DEFINE(HAVE_SCHED_RT_HEADER, 1, [linux/sched/rt.h exists])
+ AC_MSG_RESULT(yes)
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+])
+
+dnl #
+dnl # 3.9 API change,
+dnl # vfs_getattr() uses 2 args
+dnl # It takes struct path * instead of struct vfsmount * and struct dentry *
+dnl #
+AC_DEFUN([SPL_AC_2ARGS_VFS_GETATTR], [
+ AC_MSG_CHECKING([whether vfs_getattr() wants])
+ SPL_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+ ],[
+ vfs_getattr((struct path *) NULL,
+ (struct kstat *)NULL);
+ ],[
+ AC_MSG_RESULT(2 args)
+ AC_DEFINE(HAVE_2ARGS_VFS_GETATTR, 1,
+ [vfs_getattr wants 2 args])
+ ],[
+ SPL_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+ ],[
+ vfs_getattr((struct vfsmount *)NULL,
+ (struct dentry *)NULL,
+ (struct kstat *)NULL);
+ ],[
+ AC_MSG_RESULT(3 args)
+ ],[
+ AC_MSG_ERROR(unknown)
+ ])
+ ])
+])
diff --git a/include/sys/sysmacros.h b/include/sys/sysmacros.h
index 7c4da67fc..b4778b70e 100644
--- a/include/sys/sysmacros.h
+++ b/include/sys/sysmacros.h
@@ -26,12 +26,17 @@
#define _SPL_SYSMACROS_H
#include <linux/module.h>
+#include <linux/sched.h>
#include <linux/cpumask.h>
#include <sys/debug.h>
#include <sys/varargs.h>
#include <sys/zone.h>
#include <sys/signal.h>
+#ifdef HAVE_SCHED_RT_HEADER
+#include <linux/sched/rt.h>
+#endif
+
#ifndef _KERNEL
#define _KERNEL __KERNEL__
#endif
diff --git a/module/spl/spl-kmem.c b/module/spl/spl-kmem.c
index e3538b5ff..f9c111491 100644
--- a/module/spl/spl-kmem.c
+++ b/module/spl/spl-kmem.c
@@ -404,7 +404,8 @@ kmem_del_init(spinlock_t *lock, struct hlist_head *table, int bits, const void *
spin_lock_irqsave(lock, flags);
head = &table[hash_ptr(addr, bits)];
- hlist_for_each_entry_rcu(p, node, head, kd_hlist) {
+ hlist_for_each_rcu(node, head) {
+ p = list_entry_rcu(node, struct kmem_debug, kd_hlist);
if (p->kd_addr == addr) {
hlist_del_init(&p->kd_hlist);
list_del_init(&p->kd_list);
diff --git a/module/spl/spl-tsd.c b/module/spl/spl-tsd.c
index d7749cf7b..6e5605b9d 100644
--- a/module/spl/spl-tsd.c
+++ b/module/spl/spl-tsd.c
@@ -113,7 +113,8 @@ tsd_hash_search(tsd_hash_table_t *table, uint_t key, pid_t pid)
hash = hash_long((ulong_t)key * (ulong_t)pid, table->ht_bits);
bin = &table->ht_bins[hash];
spin_lock(&bin->hb_lock);
- hlist_for_each_entry(entry, node, &bin->hb_head, he_list) {
+ hlist_for_each(node, &bin->hb_head) {
+ entry = list_entry(node, tsd_hash_entry_t, he_list);
if ((entry->he_key == key) && (entry->he_pid == pid)) {
spin_unlock(&bin->hb_lock);
SRETURN(entry);
diff --git a/module/spl/spl-vnode.c b/module/spl/spl-vnode.c
index 4d571c6c4..4f56f1039 100644
--- a/module/spl/spl-vnode.c
+++ b/module/spl/spl-vnode.c
@@ -175,7 +175,11 @@ vn_open(const char *path, uio_seg_t seg, int flags, int mode,
if (IS_ERR(fp))
SRETURN(-PTR_ERR(fp));
- rc = vfs_getattr(fp->f_vfsmnt, fp->f_dentry, &stat);
+#ifdef HAVE_2ARGS_VFS_GETATTR
+ rc = vfs_getattr(&fp->f_path, &stat);
+#else
+ rc = vfs_getattr(fp->f_path.mnt, fp->f_dentry, &stat);
+#endif
if (rc) {
filp_close(fp, 0);
SRETURN(-rc);
@@ -602,7 +606,11 @@ vn_getattr(vnode_t *vp, vattr_t *vap, int flags, void *x3, void *x4)
fp = vp->v_file;
- rc = vfs_getattr(fp->f_vfsmnt, fp->f_dentry, &stat);
+#ifdef HAVE_2ARGS_VFS_GETATTR
+ rc = vfs_getattr(&fp->f_path, &stat);
+#else
+ rc = vfs_getattr(fp->f_path.mnt, fp->f_dentry, &stat);
+#endif
if (rc)
SRETURN(-rc);
@@ -754,7 +762,12 @@ vn_getf(int fd)
if (vp == NULL)
SGOTO(out_fget, rc);
- if (vfs_getattr(lfp->f_vfsmnt, lfp->f_dentry, &stat))
+#ifdef HAVE_2ARGS_VFS_GETATTR
+ rc = vfs_getattr(&lfp->f_path, &stat);
+#else
+ rc = vfs_getattr(lfp->f_path.mnt, lfp->f_dentry, &stat);
+#endif
+ if (rc)
SGOTO(out_vnode, rc);
mutex_enter(&vp->v_lock);
@@ -824,10 +837,12 @@ vn_releasef(int fd)
EXPORT_SYMBOL(releasef);
#ifndef HAVE_SET_FS_PWD
-# ifdef HAVE_2ARGS_SET_FS_PWD
-/* Used from 2.6.25 - 2.6.31+ */
void
+# ifdef HAVE_SET_FS_PWD_WITH_CONST
+set_fs_pwd(struct fs_struct *fs, const struct path *path)
+# else
set_fs_pwd(struct fs_struct *fs, struct path *path)
+# endif
{
struct path old_pwd;
@@ -848,37 +863,16 @@ set_fs_pwd(struct fs_struct *fs, struct path *path)
if (old_pwd.dentry)
path_put(&old_pwd);
}
-# else
-/* Used from 2.6.11 - 2.6.24 */
-void
-set_fs_pwd(struct fs_struct *fs, struct vfsmount *mnt, struct dentry *dentry)
-{
- struct dentry *old_pwd;
- struct vfsmount *old_pwdmnt;
-
- write_lock(&fs->lock);
- old_pwd = fs->pwd;
- old_pwdmnt = fs->pwdmnt;
- fs->pwdmnt = mntget(mnt);
- fs->pwd = dget(dentry);
- write_unlock(&fs->lock);
-
- if (old_pwd) {
- dput(old_pwd);
- mntput(old_pwdmnt);
- }
-}
-# endif /* HAVE_2ARGS_SET_FS_PWD */
#endif /* HAVE_SET_FS_PWD */
int
vn_set_pwd(const char *filename)
{
-#if defined(HAVE_2ARGS_SET_FS_PWD) && defined(HAVE_USER_PATH_DIR)
+#ifdef HAVE_USER_PATH_DIR
struct path path;
#else
struct nameidata nd;
-#endif /* HAVE_2ARGS_SET_FS_PWD */
+#endif /* HAVE_USER_PATH_DIR */
mm_segment_t saved_fs;
int rc;
SENTRY;
@@ -891,7 +885,6 @@ vn_set_pwd(const char *filename)
saved_fs = get_fs();
set_fs(get_ds());
-#ifdef HAVE_2ARGS_SET_FS_PWD
# ifdef HAVE_USER_PATH_DIR
rc = user_path_dir(filename, &path);
if (rc)
@@ -920,21 +913,6 @@ dput_and_out:
dput_and_out:
path_put(&nd.path);
# endif /* HAVE_USER_PATH_DIR */
-#else
- rc = __user_walk(filename,
- LOOKUP_FOLLOW|LOOKUP_DIRECTORY|LOOKUP_CHDIR, &nd);
- if (rc)
- SGOTO(out, rc);
-
- rc = vfs_permission(&nd, MAY_EXEC);
- if (rc)
- SGOTO(dput_and_out, rc);
-
- set_fs_pwd(current->fs, nd.nd_mnt, nd.nd_dentry);
-
-dput_and_out:
- vn_path_release(&nd);
-#endif /* HAVE_2ARGS_SET_FS_PWD */
out:
set_fs(saved_fs);