]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
UBUNTU: SAUCE: (noup) Update spl to 0.6.5.9-1ubuntu1, zfs to 0.6.5.9-5ubuntu5
authorColin Ian King <colin.king@canonical.com>
Tue, 2 May 2017 14:32:47 +0000 (15:32 +0100)
committerSeth Forshee <seth.forshee@canonical.com>
Tue, 5 Sep 2017 12:33:42 +0000 (07:33 -0500)
Add upstream SPL compat patches from upstream to build with 4.11 kernel:
 - 8d5feecacfdcca Linux 4.11 compat: set_task_state() removed
 - 94b1ab2ae01e9e Linux 4.11 compat: vfs_getattr() takes 4 args
 - 9a054d54fb6772 Linux 4.11 compat: add linux/sched/signal.h
 - bf8abea4dade11 Linux 4.11 compat: remove stub for __put_task_struct

Add upstream ZFS compat patches from upstream to build with 4.11 kernel:
 - a3478c07475261 Linux 4.11 compat: iops.getattr and friends
 - 4859fe796c5b03 Linux 4.11 compat: avoid refcount_t name conflict

Tested and verified against the Ubuntu ZFS autotest regression tests

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
26 files changed:
spl/META
spl/config/spl-build.m4
spl/configure
spl/include/sys/signal.h
spl/module/spl/spl-err.c
spl/module/spl/spl-generic.c
spl/module/spl/spl-vnode.c
spl/spl_config.h.in
zfs/META
zfs/Makefile.in
zfs/aclocal.m4
zfs/config/kernel-inode-getattr.m4 [new file with mode: 0644]
zfs/config/kernel.m4
zfs/configure
zfs/include/Makefile.in
zfs/include/linux/Makefile.in
zfs/include/linux/vfs_compat.h
zfs/include/sys/Makefile.in
zfs/include/sys/fm/Makefile.in
zfs/include/sys/fm/fs/Makefile.in
zfs/include/sys/fs/Makefile.in
zfs/include/sys/refcount.h
zfs/module/zfs/refcount.c
zfs/module/zfs/zpl_ctldir.c
zfs/module/zfs/zpl_inode.c
zfs/zfs_config.h.in

index c7b69beebec557efaafb617d585d2980cb820b9b..efdbe6702e1bfee89ee74f3d50c8ee45fabdc723 100644 (file)
--- a/spl/META
+++ b/spl/META
@@ -2,7 +2,7 @@ Meta:         1
 Name:         spl
 Branch:       1.0
 Version:      0.6.5.9
-Release:      1
+Release:      1ubuntu1
 Release-Tags: relext
 License:      GPL
 Author:       OpenZFS on Linux
index 5a2f1ded2534c0938da2fa49b05c1a224fffe77e..d886ddf15a46381978813628c4adf47d6c67655e 100644 (file)
@@ -33,7 +33,6 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
        SPL_AC_INODE_TRUNCATE_RANGE
        SPL_AC_FS_STRUCT_SPINLOCK
        SPL_AC_KUIDGID_T
-       SPL_AC_PUT_TASK_STRUCT
        SPL_AC_KERNEL_FALLOCATE
        SPL_AC_CONFIG_ZLIB_INFLATE
        SPL_AC_CONFIG_ZLIB_DEFLATE
@@ -43,6 +42,9 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
        SPL_AC_RWSEM_ACTIVITY
        SPL_AC_RWSEM_ATOMIC_LONG_COUNT
        SPL_AC_SCHED_RT_HEADER
+       SPL_AC_SCHED_SIGNAL_HEADER
+       SPL_AC_4ARGS_VFS_GETATTR
+       SPL_AC_3ARGS_VFS_GETATTR
        SPL_AC_2ARGS_VFS_GETATTR
        SPL_AC_USLEEP_RANGE
        SPL_AC_KMEM_CACHE_ALLOCFLAGS
@@ -1081,25 +1083,6 @@ AC_DEFUN([SPL_AC_KUIDGID_T], [
        ])
 ])
 
-dnl #
-dnl # 2.6.39 API change,
-dnl # __put_task_struct() was exported by the mainline kernel.
-dnl #
-AC_DEFUN([SPL_AC_PUT_TASK_STRUCT],
-       [AC_MSG_CHECKING([whether __put_task_struct() is available])
-       SPL_LINUX_TRY_COMPILE_SYMBOL([
-               #include <linux/sched.h>
-       ], [
-               __put_task_struct(NULL);
-       ], [__put_task_struct], [], [
-               AC_MSG_RESULT(yes)
-               AC_DEFINE(HAVE_PUT_TASK_STRUCT, 1,
-                         [__put_task_struct() is available])
-       ], [
-               AC_MSG_RESULT(no)
-       ])
-])
-
 dnl #
 dnl # 2.6.35 API change,
 dnl # Unused 'struct dentry *' removed from vfs_fsync() prototype.
@@ -1409,33 +1392,84 @@ AC_DEFUN([SPL_AC_SCHED_RT_HEADER],
 ])
 
 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 # 4.11 API change,
+dnl # Moved things from linux/sched.h to linux/sched/signal.h
+dnl #
+AC_DEFUN([SPL_AC_SCHED_SIGNAL_HEADER],
+       [AC_MSG_CHECKING([whether header linux/sched/signal.h exists])
+       SPL_LINUX_TRY_COMPILE([
+               #include <linux/sched.h>
+               #include <linux/sched/signal.h>
+       ],[
+               return 0;
+       ],[
+               AC_DEFINE(HAVE_SCHED_SIGNAL_HEADER, 1, [linux/sched/signal.h exists])
+               AC_MSG_RESULT(yes)
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+])
+
+dnl #
+dnl # 4.11 API, a528d35e@torvalds/linux
+dnl # vfs_getattr(const struct path *p, struct kstat *s, u32 m, unsigned int f)
+dnl #
+AC_DEFUN([SPL_AC_4ARGS_VFS_GETATTR], [
+       AC_MSG_CHECKING([whether vfs_getattr() wants 4 args])
+       SPL_LINUX_TRY_COMPILE([
+               #include <linux/fs.h>
+       ],[
+               vfs_getattr((const struct path *)NULL,
+                       (struct kstat *)NULL,
+                       (u32)0,
+                       (unsigned int)0);
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_4ARGS_VFS_GETATTR, 1,
+                 [vfs_getattr wants 4 args])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+])
+
+dnl #
+dnl # 3.9 API 
+dnl # vfs_getattr(struct path *p, struct kstat *s)
 dnl #
 AC_DEFUN([SPL_AC_2ARGS_VFS_GETATTR], [
-       AC_MSG_CHECKING([whether vfs_getattr() wants])
+       AC_MSG_CHECKING([whether vfs_getattr() wants 2 args])
        SPL_LINUX_TRY_COMPILE([
                #include <linux/fs.h>
        ],[
                vfs_getattr((struct path *) NULL,
                        (struct kstat *)NULL);
        ],[
-               AC_MSG_RESULT(2 args)
+               AC_MSG_RESULT(yes)
                AC_DEFINE(HAVE_2ARGS_VFS_GETATTR, 1,
-                         [vfs_getattr wants 2 args])
+                         [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)
-               ])
+               AC_MSG_RESULT(no)
+       ])
+])
+
+dnl #
+dnl # <3.9 API 
+dnl # vfs_getattr(struct vfsmount *v, struct dentry *d, struct kstat *k)
+dnl #
+AC_DEFUN([SPL_AC_3ARGS_VFS_GETATTR], [
+       AC_MSG_CHECKING([whether vfs_getattr() wants 3 args])
+       SPL_LINUX_TRY_COMPILE([
+               #include <linux/fs.h>
+       ],[
+               vfs_getattr((struct vfsmount *)NULL,
+                       (struct dentry *)NULL,
+                       (struct kstat *)NULL);
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_3ARGS_VFS_GETATTR, 1,
+                 [vfs_getattr wants 3 args])
+       ],[
+               AC_MSG_RESULT(no)
        ])
 ])
 
index 5e323aeee320e9154c1313f8410e65a129e6e575..9f493590abedf5f6887f12c3e68d8794e88ef987 100755 (executable)
 
 
 
-       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether __put_task_struct() is available" >&5
-$as_echo_n "checking whether __put_task_struct() is available... " >&6; }
-
-
-
-cat confdefs.h - <<_ACEOF >conftest.c
-
-
-               #include <linux/sched.h>
-
-int
-main (void)
-{
-
-               __put_task_struct(NULL);
-
-  ;
-  return 0;
-}
-
-_ACEOF
-
-
-       rm -Rf build && mkdir -p build && touch build/conftest.mod.c
-       echo "obj-m := conftest.o" >build/Makefile
-       modpost_flag=''
-       test "x$enable_linux_builtin" = xyes && modpost_flag='modpost=true' # fake modpost stage
-       if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build $modpost_flag'
-  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; } >/dev/null && { ac_try='test -s build/conftest.o'
-  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; }; then :
-  rc=0
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
- rc=1
-
-
-fi
-       rm -Rf build
-
-
-       if test $rc -ne 0; then :
-
-               { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-       else
-               if test "x$enable_linux_builtin" != xyes; then
-
-       grep -q -E '[[:space:]]__put_task_struct[[:space:]]' \
-               $LINUX_OBJ/Module*.symvers 2>/dev/null
-       rc=$?
-       if test $rc -ne 0; then
-               export=0
-               for file in ; do
-                       grep -q -E "EXPORT_SYMBOL.*(__put_task_struct)" \
-                               "$LINUX_OBJ/$file" 2>/dev/null
-                       rc=$?
-                       if test $rc -eq 0; then
-                               export=1
-                               break;
-                       fi
-               done
-               if test $export -eq 0; then :
-                       rc=1
-               else :
-                       rc=0
-               fi
-       else :
-               rc=0
-       fi
-
-               fi
-               if test $rc -ne 0; then :
-
-               { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-               else :
-
-               { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
-$as_echo "#define HAVE_PUT_TASK_STRUCT 1" >>confdefs.h
-
-
-               fi
-       fi
-
-
 
 
        { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether fops->fallocate() exists" >&5
@@ -14788,14 +14690,73 @@ $as_echo "no" >&6; }
 
 
 
+fi
+       rm -Rf build
+
+
+
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether header linux/sched/signal.h exists" >&5
+$as_echo_n "checking whether header linux/sched/signal.h exists... " >&6; }
+
+
+cat confdefs.h - <<_ACEOF >conftest.c
+
+
+               #include <linux/sched.h>
+               #include <linux/sched/signal.h>
+
+int
+main (void)
+{
+
+               return 0;
+
+  ;
+  return 0;
+}
+
+_ACEOF
+
+
+       rm -Rf build && mkdir -p build && touch build/conftest.mod.c
+       echo "obj-m := conftest.o" >build/Makefile
+       modpost_flag=''
+       test "x$enable_linux_builtin" = xyes && modpost_flag='modpost=true' # fake modpost stage
+       if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build $modpost_flag'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; } >/dev/null && { ac_try='test -s build/conftest.o'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
+
+
+$as_echo "#define HAVE_SCHED_SIGNAL_HEADER 1" >>confdefs.h
+
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+
+
 fi
        rm -Rf build
 
 
 
 
-       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether vfs_getattr() wants" >&5
-$as_echo_n "checking whether vfs_getattr() wants... " >&6; }
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether vfs_getattr() wants 4 args" >&5
+$as_echo_n "checking whether vfs_getattr() wants 4 args... " >&6; }
 
 
 cat confdefs.h - <<_ACEOF >conftest.c
@@ -14807,8 +14768,10 @@ int
 main (void)
 {
 
-               vfs_getattr((struct path *) NULL,
-                       (struct kstat *)NULL);
+               vfs_getattr((const struct path *)NULL,
+                       (struct kstat *)NULL,
+                       (u32)0,
+                       (unsigned int)0);
 
   ;
   return 0;
@@ -14833,30 +14796,43 @@ _ACEOF
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; }; then :
 
-               { $as_echo "$as_me:${as_lineno-$LINENO}: result: 2 args" >&5
-$as_echo "2 args" >&6; }
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 
-$as_echo "#define HAVE_2ARGS_VFS_GETATTR 1" >>confdefs.h
+$as_echo "#define HAVE_4ARGS_VFS_GETATTR 1" >>confdefs.h
 
 
 else
   $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+
+
+fi
+       rm -Rf build
+
+
+
+
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether vfs_getattr() wants 3 args" >&5
+$as_echo_n "checking whether vfs_getattr() wants 3 args... " >&6; }
 
 
 cat confdefs.h - <<_ACEOF >conftest.c
 
 
-                       #include <linux/fs.h>
+               #include <linux/fs.h>
 
 int
 main (void)
 {
 
-                       vfs_getattr((struct vfsmount *)NULL,
-                               (struct dentry *)NULL,
-                               (struct kstat *)NULL);
+               vfs_getattr((struct vfsmount *)NULL,
+                       (struct dentry *)NULL,
+                       (struct kstat *)NULL);
 
   ;
   return 0;
@@ -14881,14 +14857,18 @@ _ACEOF
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; }; then :
 
-                       { $as_echo "$as_me:${as_lineno-$LINENO}: result: 3 args" >&5
-$as_echo "3 args" >&6; }
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAVE_3ARGS_VFS_GETATTR 1" >>confdefs.h
+
 
 else
   $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-                       as_fn_error $? "unknown" "$LINENO" 5
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
 
 
 
 
 
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether vfs_getattr() wants 2 args" >&5
+$as_echo_n "checking whether vfs_getattr() wants 2 args... " >&6; }
+
+
+cat confdefs.h - <<_ACEOF >conftest.c
+
+
+               #include <linux/fs.h>
+
+int
+main (void)
+{
+
+               vfs_getattr((struct path *) NULL,
+                       (struct kstat *)NULL);
+
+  ;
+  return 0;
+}
+
+_ACEOF
+
+
+       rm -Rf build && mkdir -p build && touch build/conftest.mod.c
+       echo "obj-m := conftest.o" >build/Makefile
+       modpost_flag=''
+       test "x$enable_linux_builtin" = xyes && modpost_flag='modpost=true' # fake modpost stage
+       if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build $modpost_flag'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; } >/dev/null && { ac_try='test -s build/conftest.o'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
+
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAVE_2ARGS_VFS_GETATTR 1" >>confdefs.h
+
+
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+
 
 fi
        rm -Rf build
 
 
 
-       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether __put_task_struct() is available" >&5
-$as_echo_n "checking whether __put_task_struct() is available... " >&6; }
-
-
-
-cat confdefs.h - <<_ACEOF >conftest.c
-
-
-               #include <linux/sched.h>
-
-int
-main (void)
-{
-
-               __put_task_struct(NULL);
-
-  ;
-  return 0;
-}
-
-_ACEOF
-
-
-       rm -Rf build && mkdir -p build && touch build/conftest.mod.c
-       echo "obj-m := conftest.o" >build/Makefile
-       modpost_flag=''
-       test "x$enable_linux_builtin" = xyes && modpost_flag='modpost=true' # fake modpost stage
-       if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build $modpost_flag'
-  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; } >/dev/null && { ac_try='test -s build/conftest.o'
-  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; }; then :
-  rc=0
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
- rc=1
-
-
-fi
-       rm -Rf build
-
-
-       if test $rc -ne 0; then :
-
-               { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-       else
-               if test "x$enable_linux_builtin" != xyes; then
-
-       grep -q -E '[[:space:]]__put_task_struct[[:space:]]' \
-               $LINUX_OBJ/Module*.symvers 2>/dev/null
-       rc=$?
-       if test $rc -ne 0; then
-               export=0
-               for file in ; do
-                       grep -q -E "EXPORT_SYMBOL.*(__put_task_struct)" \
-                               "$LINUX_OBJ/$file" 2>/dev/null
-                       rc=$?
-                       if test $rc -eq 0; then
-                               export=1
-                               break;
-                       fi
-               done
-               if test $export -eq 0; then :
-                       rc=1
-               else :
-                       rc=0
-               fi
-       else :
-               rc=0
-       fi
-
-               fi
-               if test $rc -ne 0; then :
-
-               { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-               else :
-
-               { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
-$as_echo "#define HAVE_PUT_TASK_STRUCT 1" >>confdefs.h
-
-
-               fi
-       fi
-
-
 
 
        { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether fops->fallocate() exists" >&5
@@ -17739,14 +17674,73 @@ $as_echo "no" >&6; }
 
 
 
+fi
+       rm -Rf build
+
+
+
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether header linux/sched/signal.h exists" >&5
+$as_echo_n "checking whether header linux/sched/signal.h exists... " >&6; }
+
+
+cat confdefs.h - <<_ACEOF >conftest.c
+
+
+               #include <linux/sched.h>
+               #include <linux/sched/signal.h>
+
+int
+main (void)
+{
+
+               return 0;
+
+  ;
+  return 0;
+}
+
+_ACEOF
+
+
+       rm -Rf build && mkdir -p build && touch build/conftest.mod.c
+       echo "obj-m := conftest.o" >build/Makefile
+       modpost_flag=''
+       test "x$enable_linux_builtin" = xyes && modpost_flag='modpost=true' # fake modpost stage
+       if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build $modpost_flag'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; } >/dev/null && { ac_try='test -s build/conftest.o'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
+
+
+$as_echo "#define HAVE_SCHED_SIGNAL_HEADER 1" >>confdefs.h
+
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+
+
 fi
        rm -Rf build
 
 
 
 
-       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether vfs_getattr() wants" >&5
-$as_echo_n "checking whether vfs_getattr() wants... " >&6; }
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether vfs_getattr() wants 4 args" >&5
+$as_echo_n "checking whether vfs_getattr() wants 4 args... " >&6; }
 
 
 cat confdefs.h - <<_ACEOF >conftest.c
@@ -17758,8 +17752,10 @@ int
 main (void)
 {
 
-               vfs_getattr((struct path *) NULL,
-                       (struct kstat *)NULL);
+               vfs_getattr((const struct path *)NULL,
+                       (struct kstat *)NULL,
+                       (u32)0,
+                       (unsigned int)0);
 
   ;
   return 0;
@@ -17784,30 +17780,43 @@ _ACEOF
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; }; then :
 
-               { $as_echo "$as_me:${as_lineno-$LINENO}: result: 2 args" >&5
-$as_echo "2 args" >&6; }
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 
-$as_echo "#define HAVE_2ARGS_VFS_GETATTR 1" >>confdefs.h
+$as_echo "#define HAVE_4ARGS_VFS_GETATTR 1" >>confdefs.h
 
 
 else
   $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+
+
+fi
+       rm -Rf build
+
+
+
+
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether vfs_getattr() wants 3 args" >&5
+$as_echo_n "checking whether vfs_getattr() wants 3 args... " >&6; }
 
 
 cat confdefs.h - <<_ACEOF >conftest.c
 
 
-                       #include <linux/fs.h>
+               #include <linux/fs.h>
 
 int
 main (void)
 {
 
-                       vfs_getattr((struct vfsmount *)NULL,
-                               (struct dentry *)NULL,
-                               (struct kstat *)NULL);
+               vfs_getattr((struct vfsmount *)NULL,
+                       (struct dentry *)NULL,
+                       (struct kstat *)NULL);
 
   ;
   return 0;
@@ -17832,14 +17841,18 @@ _ACEOF
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; }; then :
 
-                       { $as_echo "$as_me:${as_lineno-$LINENO}: result: 3 args" >&5
-$as_echo "3 args" >&6; }
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAVE_3ARGS_VFS_GETATTR 1" >>confdefs.h
+
 
 else
   $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-                       as_fn_error $? "unknown" "$LINENO" 5
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
 
 
 
 
 
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether vfs_getattr() wants 2 args" >&5
+$as_echo_n "checking whether vfs_getattr() wants 2 args... " >&6; }
+
+
+cat confdefs.h - <<_ACEOF >conftest.c
+
+
+               #include <linux/fs.h>
+
+int
+main (void)
+{
+
+               vfs_getattr((struct path *) NULL,
+                       (struct kstat *)NULL);
+
+  ;
+  return 0;
+}
+
+_ACEOF
+
+
+       rm -Rf build && mkdir -p build && touch build/conftest.mod.c
+       echo "obj-m := conftest.o" >build/Makefile
+       modpost_flag=''
+       test "x$enable_linux_builtin" = xyes && modpost_flag='modpost=true' # fake modpost stage
+       if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build $modpost_flag'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; } >/dev/null && { ac_try='test -s build/conftest.o'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
+
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAVE_2ARGS_VFS_GETATTR 1" >>confdefs.h
+
+
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+
 
 fi
        rm -Rf build
index 823fea32912e99b17fd2657b159dd0e3e1f66f1c..77cc2d3c2fb5a553ff1ad074df7b8ed1dfb10747 100644 (file)
 
 #include <linux/sched.h>
 
+#ifdef HAVE_SCHED_SIGNAL_HEADER
+#include <linux/sched/signal.h>
+#endif
+
 #define        FORREAL         0       /* Usual side-effects */
 #define        JUSTLOOKING     1       /* Don't stop the process */
 
index 14ff8a3373f533cb539099ef81af16bbcdd1a5e2..cf9f096b11cb200053a699738471e6680f907993 100644 (file)
@@ -65,7 +65,7 @@ spl_panic(const char *file, const char *func, int line, const char *fmt, ...) {
        spl_dumpstack();
 
        /* Halt the thread to facilitate further debugging */
-       set_task_state(current, TASK_UNINTERRUPTIBLE);
+       set_current_state(TASK_UNINTERRUPTIBLE);
        while (1)
                schedule();
 
@@ -98,7 +98,7 @@ vcmn_err(int ce, const char *fmt, va_list ap)
                spl_dumpstack();
 
                /* Halt the thread to facilitate further debugging */
-               set_task_state(current, TASK_UNINTERRUPTIBLE);
+               set_current_state(TASK_UNINTERRUPTIBLE);
                while (1)
                        schedule();
        }
index c01a646a4d5d755697a4facad3f00fd4501d4ee8..b2bd1b837a9f1c6cd5a035aa0244b002446d64e6 100644 (file)
@@ -351,22 +351,6 @@ ddi_copyout(const void *from, void *to, size_t len, int flags)
 }
 EXPORT_SYMBOL(ddi_copyout);
 
-#ifndef HAVE_PUT_TASK_STRUCT
-/*
- * This is only a stub function which should never be used.  The SPL should
- * never be putting away the last reference on a task structure so this will
- * not be called.  However, we still need to define it so the module does not
- * have undefined symbol at load time.  That all said if this impossible
- * thing does somehow happen PANIC immediately so we know about it.
- */
-void
-__put_task_struct(struct task_struct *t)
-{
-       PANIC("Unexpectly put last reference on task %d\n", (int)t->pid);
-}
-EXPORT_SYMBOL(__put_task_struct);
-#endif /* HAVE_PUT_TASK_STRUCT */
-
 /*
  * Read the unique system identifier from the /etc/hostid file.
  *
index f1ebcd2d63c7ee95afcec9d01b97455fe9ab79a1..a548d37f7acb8097335c432d742a45e3da69d069 100644 (file)
@@ -156,7 +156,9 @@ vn_open(const char *path, uio_seg_t seg, int flags, int mode,
        if (IS_ERR(fp))
                return (-PTR_ERR(fp));
 
-#ifdef HAVE_2ARGS_VFS_GETATTR
+#if defined(HAVE_4ARGS_VFS_GETATTR)
+       rc = vfs_getattr(&fp->f_path, &stat, STATX_TYPE, AT_STATX_SYNC_AS_STAT);
+#elif defined(HAVE_2ARGS_VFS_GETATTR)
        rc = vfs_getattr(&fp->f_path, &stat);
 #else
        rc = vfs_getattr(fp->f_path.mnt, fp->f_dentry, &stat);
@@ -514,7 +516,10 @@ vn_getattr(vnode_t *vp, vattr_t *vap, int flags, void *x3, void *x4)
 
        fp = vp->v_file;
 
-#ifdef HAVE_2ARGS_VFS_GETATTR
+#if defined(HAVE_4ARGS_VFS_GETATTR)
+       rc = vfs_getattr(&fp->f_path, &stat, STATX_BASIC_STATS,
+           AT_STATX_SYNC_AS_STAT);
+#elif defined(HAVE_2ARGS_VFS_GETATTR)
        rc = vfs_getattr(&fp->f_path, &stat);
 #else
        rc = vfs_getattr(fp->f_path.mnt, fp->f_dentry, &stat);
@@ -684,7 +689,9 @@ vn_getf(int fd)
        if (vp == NULL)
                goto out_fget;
 
-#ifdef HAVE_2ARGS_VFS_GETATTR
+#if defined(HAVE_4ARGS_VFS_GETATTR)
+       rc = vfs_getattr(&lfp->f_path, &stat, STATX_TYPE, AT_STATX_SYNC_AS_STAT);
+#elif defined(HAVE_2ARGS_VFS_GETATTR)
        rc = vfs_getattr(&lfp->f_path, &stat);
 #else
        rc = vfs_getattr(lfp->f_path.mnt, lfp->f_dentry, &stat);
index 463c5f98f5a8b37d2d28705a5d2cd69e007e9ab0..7cd020be11510e8c4128e4e70b7550256279225b 100644 (file)
 /* old shrinker callback wants 3 args */
 #undef HAVE_3ARGS_SHRINKER_CALLBACK
 
+/* vfs_getattr wants 3 args */
+#undef HAVE_3ARGS_VFS_GETATTR
+
 /* vfs_unlink() wants 3 args */
 #undef HAVE_3ARGS_VFS_UNLINK
 
+/* vfs_getattr wants 4 args */
+#undef HAVE_4ARGS_VFS_GETATTR
+
 /* vfs_rename() wants 4 args */
 #undef HAVE_4ARGS_VFS_RENAME
 
@@ -90,9 +96,6 @@
 /* yes */
 #undef HAVE_PDE_DATA
 
-/* __put_task_struct() is available */
-#undef HAVE_PUT_TASK_STRUCT
-
 /* struct rw_semaphore has member activity */
 #undef HAVE_RWSEM_ACTIVITY
 
 /* linux/sched/rt.h exists */
 #undef HAVE_SCHED_RT_HEADER
 
+/* linux/sched/signal.h exists */
+#undef HAVE_SCHED_SIGNAL_HEADER
+
 /* set_fs_pwd() needs const path * */
 #undef HAVE_SET_FS_PWD_WITH_CONST
 
index e5c868850eeb69879bcf0fbf835e31e25ae16e4f..aaa41d5cf4e08ffe328b128e12a3ee8033617842 100644 (file)
--- a/zfs/META
+++ b/zfs/META
@@ -2,7 +2,7 @@ Meta:         1
 Name:         zfs
 Branch:       1.0
 Version:      0.6.5.9
-Release:      2
+Release:      5ubuntu5
 Release-Tags: relext
 License:      CDDL
 Author:       OpenZFS on Linux
index 3147144bb35ea000fe6ae20323cec89b7368ac9c..76d341c30e1ac687a61b969495732f0a8b431f89 100644 (file)
@@ -147,6 +147,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \
        $(top_srcdir)/config/kernel-get-disk-ro.m4 \
        $(top_srcdir)/config/kernel-get-gendisk.m4 \
        $(top_srcdir)/config/kernel-get-link.m4 \
+       $(top_srcdir)/config/kernel-inode-getattr.m4 \
        $(top_srcdir)/config/kernel-insert-inode-locked.m4 \
        $(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
        $(top_srcdir)/config/kernel-is_owner_or_cap.m4 \
index 51a5d6fd9317e38771f56d3e641b5f5fb73af7ce..95ba8522e75b59c88f5e1bb60452ff6aecd8f53c 100644 (file)
@@ -1254,6 +1254,7 @@ m4_include([config/kernel-generic_readlink.m4])
 m4_include([config/kernel-get-disk-ro.m4])
 m4_include([config/kernel-get-gendisk.m4])
 m4_include([config/kernel-get-link.m4])
+m4_include([config/kernel-inode-getattr.m4])
 m4_include([config/kernel-insert-inode-locked.m4])
 m4_include([config/kernel-invalidate-bdev-args.m4])
 m4_include([config/kernel-is_owner_or_cap.m4])
diff --git a/zfs/config/kernel-inode-getattr.m4 b/zfs/config/kernel-inode-getattr.m4
new file mode 100644 (file)
index 0000000..f10e0b2
--- /dev/null
@@ -0,0 +1,67 @@
+dnl #
+dnl # Linux 4.11 API
+dnl # See torvalds/linux@a528d35
+dnl #
+AC_DEFUN([ZFS_AC_PATH_KERNEL_IOPS_GETATTR], [
+       AC_MSG_CHECKING([whether iops->getattr() takes a path])
+       ZFS_LINUX_TRY_COMPILE([
+               #include <linux/fs.h>
+
+               int test_getattr(
+                   const struct path *p, struct kstat *k,
+                   u32 request_mask, unsigned int query_flags)
+                   { return 0; }
+
+               static const struct inode_operations
+                   iops __attribute__ ((unused)) = {
+                       .getattr = test_getattr,
+               };
+       ],[
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_PATH_IOPS_GETATTR, 1,
+                   [iops->getattr() takes a path])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+])
+
+
+
+dnl #
+dnl # Linux 3.9 - 4.10 API
+dnl #
+AC_DEFUN([ZFS_AC_VFSMOUNT_KERNEL_IOPS_GETATTR], [
+       AC_MSG_CHECKING([whether iops->getattr() takes a vfsmount])
+       ZFS_LINUX_TRY_COMPILE([
+               #include <linux/fs.h>
+
+               int test_getattr(
+                   struct vfsmount *mnt, struct dentry *d,
+                   struct kstat *k)
+                   { return 0; }
+
+               static const struct inode_operations
+                   iops __attribute__ ((unused)) = {
+                       .getattr = test_getattr,
+               };
+       ],[
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_VFSMOUNT_IOPS_GETATTR, 1,
+                   [iops->getattr() takes a vfsmount])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+])
+
+
+dnl #
+dnl # The interface of the getattr callback from the inode_operations
+dnl # structure changed.  Also, the interface of the simple_getattr()
+dnl # function provided by the kernel changed.
+dnl #
+AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_GETATTR], [
+       ZFS_AC_PATH_KERNEL_IOPS_GETATTR
+       ZFS_AC_VFSMOUNT_KERNEL_IOPS_GETATTR
+])
index 5b8abf75160b3f8ed8c0217bb25ffbc9a882e673..9ca48a2c94b83118ebe5501775371933fc22f7c2 100644 (file)
@@ -58,6 +58,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
        ZFS_AC_KERNEL_INODE_OPERATIONS_CHECK_ACL_WITH_FLAGS
        ZFS_AC_KERNEL_INODE_OPERATIONS_GET_ACL
        ZFS_AC_KERNEL_INODE_OPERATIONS_SET_ACL
+       ZFS_AC_KERNEL_INODE_OPERATIONS_GETATTR
        ZFS_AC_KERNEL_GET_ACL_HANDLE_CACHE
        ZFS_AC_KERNEL_SHOW_OPTIONS
        ZFS_AC_KERNEL_FILE_INODE
index 984208cf9cbf323a51970d0282966fff2bd14d2d..48e8e3277e79396de8d49a2d429c67b8c1ec60c4 100755 (executable)
 
 
 
+
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether iops->getattr() takes a path" >&5
+$as_echo_n "checking whether iops->getattr() takes a path... " >&6; }
+
+
+cat confdefs.h - <<_ACEOF >conftest.c
+
+
+               #include <linux/fs.h>
+
+               int test_getattr(
+                   const struct path *p, struct kstat *k,
+                   u32 request_mask, unsigned int query_flags)
+                   { return 0; }
+
+               static const struct inode_operations
+                   iops __attribute__ ((unused)) = {
+                       .getattr = test_getattr,
+               };
+
+int
+main (void)
+{
+
+
+  ;
+  return 0;
+}
+
+_ACEOF
+
+
+
+cat - <<_ACEOF >conftest.h
+
+_ACEOF
+
+
+       rm -Rf build && mkdir -p build && touch build/conftest.mod.c
+       echo "obj-m := conftest.o" >build/Makefile
+       modpost_flag=''
+       test "x$enable_linux_builtin" = xyes && modpost_flag='modpost=true' # fake modpost stage
+       if { ac_try='cp conftest.c conftest.h build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build $modpost_flag'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; } >/dev/null && { ac_try='test -s build/conftest.o'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
+
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAVE_PATH_IOPS_GETATTR 1" >>confdefs.h
+
+
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+
+
+fi
+       rm -Rf build
+
+
+
+
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether iops->getattr() takes a vfsmount" >&5
+$as_echo_n "checking whether iops->getattr() takes a vfsmount... " >&6; }
+
+
+cat confdefs.h - <<_ACEOF >conftest.c
+
+
+               #include <linux/fs.h>
+
+               int test_getattr(
+                   struct vfsmount *mnt, struct dentry *d,
+                   struct kstat *k)
+                   { return 0; }
+
+               static const struct inode_operations
+                   iops __attribute__ ((unused)) = {
+                       .getattr = test_getattr,
+               };
+
+int
+main (void)
+{
+
+
+  ;
+  return 0;
+}
+
+_ACEOF
+
+
+
+cat - <<_ACEOF >conftest.h
+
+_ACEOF
+
+
+       rm -Rf build && mkdir -p build && touch build/conftest.mod.c
+       echo "obj-m := conftest.o" >build/Makefile
+       modpost_flag=''
+       test "x$enable_linux_builtin" = xyes && modpost_flag='modpost=true' # fake modpost stage
+       if { ac_try='cp conftest.c conftest.h build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build $modpost_flag'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; } >/dev/null && { ac_try='test -s build/conftest.o'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
+
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAVE_VFSMOUNT_IOPS_GETATTR 1" >>confdefs.h
+
+
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+
+
+fi
+       rm -Rf build
+
+
+
+
+
        { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether uncached_acl_sentinel() exists" >&5
 $as_echo_n "checking whether uncached_acl_sentinel() exists... " >&6; }
 
 
 
 
+
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether iops->getattr() takes a path" >&5
+$as_echo_n "checking whether iops->getattr() takes a path... " >&6; }
+
+
+cat confdefs.h - <<_ACEOF >conftest.c
+
+
+               #include <linux/fs.h>
+
+               int test_getattr(
+                   const struct path *p, struct kstat *k,
+                   u32 request_mask, unsigned int query_flags)
+                   { return 0; }
+
+               static const struct inode_operations
+                   iops __attribute__ ((unused)) = {
+                       .getattr = test_getattr,
+               };
+
+int
+main (void)
+{
+
+
+  ;
+  return 0;
+}
+
+_ACEOF
+
+
+
+cat - <<_ACEOF >conftest.h
+
+_ACEOF
+
+
+       rm -Rf build && mkdir -p build && touch build/conftest.mod.c
+       echo "obj-m := conftest.o" >build/Makefile
+       modpost_flag=''
+       test "x$enable_linux_builtin" = xyes && modpost_flag='modpost=true' # fake modpost stage
+       if { ac_try='cp conftest.c conftest.h build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build $modpost_flag'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; } >/dev/null && { ac_try='test -s build/conftest.o'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
+
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAVE_PATH_IOPS_GETATTR 1" >>confdefs.h
+
+
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+
+
+fi
+       rm -Rf build
+
+
+
+
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether iops->getattr() takes a vfsmount" >&5
+$as_echo_n "checking whether iops->getattr() takes a vfsmount... " >&6; }
+
+
+cat confdefs.h - <<_ACEOF >conftest.c
+
+
+               #include <linux/fs.h>
+
+               int test_getattr(
+                   struct vfsmount *mnt, struct dentry *d,
+                   struct kstat *k)
+                   { return 0; }
+
+               static const struct inode_operations
+                   iops __attribute__ ((unused)) = {
+                       .getattr = test_getattr,
+               };
+
+int
+main (void)
+{
+
+
+  ;
+  return 0;
+}
+
+_ACEOF
+
+
+
+cat - <<_ACEOF >conftest.h
+
+_ACEOF
+
+
+       rm -Rf build && mkdir -p build && touch build/conftest.mod.c
+       echo "obj-m := conftest.o" >build/Makefile
+       modpost_flag=''
+       test "x$enable_linux_builtin" = xyes && modpost_flag='modpost=true' # fake modpost stage
+       if { ac_try='cp conftest.c conftest.h build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build $modpost_flag'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; } >/dev/null && { ac_try='test -s build/conftest.o'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
+
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAVE_VFSMOUNT_IOPS_GETATTR 1" >>confdefs.h
+
+
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+
+
+fi
+       rm -Rf build
+
+
+
+
+
        { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether uncached_acl_sentinel() exists" >&5
 $as_echo_n "checking whether uncached_acl_sentinel() exists... " >&6; }
 
index b0e96d4c829c8c3e1d2db1588e6332ff813e4a75..565636026926fbbae6ee35b5b2da9257068eb336 100644 (file)
@@ -139,6 +139,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \
        $(top_srcdir)/config/kernel-get-disk-ro.m4 \
        $(top_srcdir)/config/kernel-get-gendisk.m4 \
        $(top_srcdir)/config/kernel-get-link.m4 \
+       $(top_srcdir)/config/kernel-inode-getattr.m4 \
        $(top_srcdir)/config/kernel-insert-inode-locked.m4 \
        $(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
        $(top_srcdir)/config/kernel-is_owner_or_cap.m4 \
index f0596c30912c066db3d82037735b33a93cf40e47..5190f79a8f82b66ba44e21faa3589c2ee3b825a3 100644 (file)
@@ -139,6 +139,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \
        $(top_srcdir)/config/kernel-get-disk-ro.m4 \
        $(top_srcdir)/config/kernel-get-gendisk.m4 \
        $(top_srcdir)/config/kernel-get-link.m4 \
+       $(top_srcdir)/config/kernel-inode-getattr.m4 \
        $(top_srcdir)/config/kernel-insert-inode-locked.m4 \
        $(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
        $(top_srcdir)/config/kernel-is_owner_or_cap.m4 \
index 2350fa506c6d8648683730922d1f66e7649afaf1..a0475070b4056c6b6467b1d55f8e366b148fa231 100644 (file)
@@ -368,4 +368,47 @@ setattr_prepare(struct dentry *dentry, struct iattr *ia)
 }
 #endif
 
+/*
+ * 4.11 API change
+ * These macros are defined by kernel 4.11.  We define them so that the same
+ * code builds under kernels < 4.11 and >= 4.11.  The macros are set to 0 so
+ * that it will create obvious failures if they are accidentally used when built
+ * against a kernel >= 4.11.
+ */
+
+#ifndef STATX_BASIC_STATS
+#define        STATX_BASIC_STATS       0
+#endif
+
+#ifndef AT_STATX_SYNC_AS_STAT
+#define        AT_STATX_SYNC_AS_STAT   0
+#endif
+
+/*
+ * 4.11 API change
+ * 4.11 takes struct path *, < 4.11 takes vfsmount *
+ */
+
+#ifdef HAVE_VFSMOUNT_IOPS_GETATTR
+#define        ZPL_GETATTR_WRAPPER(func)                                       \
+static int                                                             \
+func(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)  \
+{                                                                      \
+       struct path path = { .mnt = mnt, .dentry = dentry };            \
+       return func##_impl(&path, stat, STATX_BASIC_STATS,              \
+           AT_STATX_SYNC_AS_STAT);                                     \
+}
+#elif defined(HAVE_PATH_IOPS_GETATTR)
+#define        ZPL_GETATTR_WRAPPER(func)                                       \
+static int                                                             \
+func(const struct path *path, struct kstat *stat, u32 request_mask,    \
+    unsigned int query_flags)                                          \
+{                                                                      \
+       return (func##_impl(path, stat, request_mask, query_flags));    \
+}
+#else
+#error
+#endif
+
+
 #endif /* _ZFS_VFS_H */
index e305be7794fbaed6096b84db952f75dfd501312b..31ec1563152248e093ab0a676da70b995bd5546f 100644 (file)
@@ -139,6 +139,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \
        $(top_srcdir)/config/kernel-get-disk-ro.m4 \
        $(top_srcdir)/config/kernel-get-gendisk.m4 \
        $(top_srcdir)/config/kernel-get-link.m4 \
+       $(top_srcdir)/config/kernel-inode-getattr.m4 \
        $(top_srcdir)/config/kernel-insert-inode-locked.m4 \
        $(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
        $(top_srcdir)/config/kernel-is_owner_or_cap.m4 \
index a84032301bed1a8e9a3aea36ec90f90ba254a5cd..1a591251029febd0333aa87d0f8dc313a34b5a89 100644 (file)
@@ -139,6 +139,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \
        $(top_srcdir)/config/kernel-get-disk-ro.m4 \
        $(top_srcdir)/config/kernel-get-gendisk.m4 \
        $(top_srcdir)/config/kernel-get-link.m4 \
+       $(top_srcdir)/config/kernel-inode-getattr.m4 \
        $(top_srcdir)/config/kernel-insert-inode-locked.m4 \
        $(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
        $(top_srcdir)/config/kernel-is_owner_or_cap.m4 \
index 345979146e572246ceae5500aeae0f6d79eb12ed..13ebf8e6f24c068085394f934b8b445923fc074b 100644 (file)
@@ -139,6 +139,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \
        $(top_srcdir)/config/kernel-get-disk-ro.m4 \
        $(top_srcdir)/config/kernel-get-gendisk.m4 \
        $(top_srcdir)/config/kernel-get-link.m4 \
+       $(top_srcdir)/config/kernel-inode-getattr.m4 \
        $(top_srcdir)/config/kernel-insert-inode-locked.m4 \
        $(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
        $(top_srcdir)/config/kernel-is_owner_or_cap.m4 \
index b7d24cb97181883633f8dfddb1a981ef00509d17..66ca4e2678bb368bb042fa3918d0846ba35979e9 100644 (file)
@@ -139,6 +139,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \
        $(top_srcdir)/config/kernel-get-disk-ro.m4 \
        $(top_srcdir)/config/kernel-get-gendisk.m4 \
        $(top_srcdir)/config/kernel-get-link.m4 \
+       $(top_srcdir)/config/kernel-inode-getattr.m4 \
        $(top_srcdir)/config/kernel-insert-inode-locked.m4 \
        $(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
        $(top_srcdir)/config/kernel-is_owner_or_cap.m4 \
index e767a2389dab1c38d027ef8235b046e19c4ec747..1d74187d403993b3809bfe19217e00b5a954b5cb 100644 (file)
@@ -40,6 +40,17 @@ extern "C" {
  */
 #define        FTAG ((char *)__func__)
 
+/*
+ * Starting with 4.11, torvalds/linux@f405df5, the linux kernel defines a
+ * refcount_t type of its own.  The macro below effectively changes references
+ * in the ZFS code from refcount_t to zfs_refcount_t at compile time, so that
+ * existing code need not be altered, reducing conflicts when landing openZFS
+ * patches.
+ */
+
+#define        refcount_t      zfs_refcount_t
+#define        refcount_add    zfs_refcount_add
+
 #ifdef ZFS_DEBUG
 typedef struct reference {
        list_node_t ref_link;
@@ -55,7 +66,7 @@ typedef struct refcount {
        list_t rc_removed;
        int64_t rc_count;
        int64_t rc_removed_count;
-} refcount_t;
+} zfs_refcount_t;
 
 /* Note: refcount_t must be initialized with refcount_create[_untracked]() */
 
@@ -65,7 +76,7 @@ void refcount_destroy(refcount_t *rc);
 void refcount_destroy_many(refcount_t *rc, uint64_t number);
 int refcount_is_zero(refcount_t *rc);
 int64_t refcount_count(refcount_t *rc);
-int64_t refcount_add(refcount_t *rc, void *holder_tag);
+int64_t zfs_refcount_add(refcount_t *rc, void *holder_tag);
 int64_t refcount_remove(refcount_t *rc, void *holder_tag);
 int64_t refcount_add_many(refcount_t *rc, uint64_t number, void *holder_tag);
 int64_t refcount_remove_many(refcount_t *rc, uint64_t number, void *holder_tag);
@@ -86,7 +97,7 @@ typedef struct refcount {
 #define        refcount_destroy_many(rc, number) ((rc)->rc_count = 0)
 #define        refcount_is_zero(rc) ((rc)->rc_count == 0)
 #define        refcount_count(rc) ((rc)->rc_count)
-#define        refcount_add(rc, holder) atomic_add_64_nv(&(rc)->rc_count, 1)
+#define        zfs_refcount_add(rc, holder) atomic_add_64_nv(&(rc)->rc_count, 1)
 #define        refcount_remove(rc, holder) atomic_add_64_nv(&(rc)->rc_count, -1)
 #define        refcount_add_many(rc, number, holder) \
        atomic_add_64_nv(&(rc)->rc_count, number)
index 4c460a2009673bfc24794d2fe908f75775c7dac7..25875243bad9da103321cd802f05f4ebea6ec495 100644 (file)
@@ -137,7 +137,7 @@ refcount_add_many(refcount_t *rc, uint64_t number, void *holder)
 }
 
 int64_t
-refcount_add(refcount_t *rc, void *holder)
+zfs_refcount_add(refcount_t *rc, void *holder)
 {
        return (refcount_add_many(rc, 1, holder));
 }
index d691f670b44dda8b6dfed868c769ec9cb68a7e43..10ef4d3699828d7a7974c363c69c2ea7aa6526d1 100644 (file)
@@ -100,16 +100,15 @@ zpl_root_readdir(struct file *filp, void *dirent, filldir_t filldir)
  */
 /* ARGSUSED */
 static int
-zpl_root_getattr(struct vfsmount *mnt, struct dentry *dentry,
-    struct kstat *stat)
+zpl_root_getattr_impl(const struct path *path, struct kstat *stat,
+    u32 request_mask, unsigned int query_flags)
 {
-       int error;
-
-       error = simple_getattr(mnt, dentry, stat);
+       generic_fillattr(path->dentry->d_inode, stat);
        stat->atime = CURRENT_TIME;
 
-       return (error);
+       return (0);
 }
+ZPL_GETATTR_WRAPPER(zpl_root_getattr);
 
 static struct dentry *
 #ifdef HAVE_LOOKUP_NAMEIDATA
@@ -375,21 +374,22 @@ zpl_snapdir_mkdir(struct inode *dip, struct dentry *dentry, zpl_umode_t mode)
  */
 /* ARGSUSED */
 static int
-zpl_snapdir_getattr(struct vfsmount *mnt, struct dentry *dentry,
-    struct kstat *stat)
+zpl_snapdir_getattr_impl(const struct path *path, struct kstat *stat,
+    u32 request_mask, unsigned int query_flags)
 {
-       zfs_sb_t *zsb = ITOZSB(dentry->d_inode);
-       int error;
+       zfs_sb_t *zsb = ITOZSB(path->dentry->d_inode);
 
        ZFS_ENTER(zsb);
-       error = simple_getattr(mnt, dentry, stat);
+       generic_fillattr(path->dentry->d_inode, stat);
+
        stat->nlink = stat->size = 2;
        stat->ctime = stat->mtime = dmu_objset_snap_cmtime(zsb->z_os);
        stat->atime = CURRENT_TIME;
        ZFS_EXIT(zsb);
 
-       return (error);
+       return (0);
 }
+ZPL_GETATTR_WRAPPER(zpl_snapdir_getattr);
 
 /*
  * The '.zfs/snapshot' directory file operations.  These mainly control
@@ -509,10 +509,10 @@ zpl_shares_readdir(struct file *filp, void *dirent, filldir_t filldir)
 
 /* ARGSUSED */
 static int
-zpl_shares_getattr(struct vfsmount *mnt, struct dentry *dentry,
-    struct kstat *stat)
+zpl_shares_getattr_impl(const struct path *path, struct kstat *stat,
+    u32 request_mask, unsigned int query_flags)
 {
-       struct inode *ip = dentry->d_inode;
+       struct inode *ip = path->dentry->d_inode;
        zfs_sb_t *zsb = ITOZSB(ip);
        znode_t *dzp;
        int error;
@@ -520,11 +520,11 @@ zpl_shares_getattr(struct vfsmount *mnt, struct dentry *dentry,
        ZFS_ENTER(zsb);
 
        if (zsb->z_shares_dir == 0) {
-               error = simple_getattr(mnt, dentry, stat);
+               generic_fillattr(path->dentry->d_inode, stat);
                stat->nlink = stat->size = 2;
                stat->atime = CURRENT_TIME;
                ZFS_EXIT(zsb);
-               return (error);
+               return (0);
        }
 
        error = -zfs_zget(zsb, zsb->z_shares_dir, &dzp);
@@ -538,6 +538,7 @@ zpl_shares_getattr(struct vfsmount *mnt, struct dentry *dentry,
 
        return (error);
 }
+ZPL_GETATTR_WRAPPER(zpl_shares_getattr);
 
 /*
  * The '.zfs/shares' directory file operations.
index 1714aa22bbd146fb9f6b29a6b1ebadc1aff14fdb..7aded9df27329fd56e4b576d7b216542f0599c5f 100644 (file)
@@ -302,18 +302,25 @@ zpl_rmdir(struct inode * dir, struct dentry *dentry)
 }
 
 static int
-zpl_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
+zpl_getattr_impl(const struct path *path, struct kstat *stat, u32 request_mask,
+    unsigned int query_flags)
 {
        int error;
        fstrans_cookie_t cookie;
 
        cookie = spl_fstrans_mark();
-       error = -zfs_getattr_fast(dentry->d_inode, stat);
+
+       /*
+        * XXX request_mask and query_flags currently ignored.
+        */
+
+       error = -zfs_getattr_fast(path->dentry->d_inode, stat);
        spl_fstrans_unmark(cookie);
        ASSERT3S(error, <=, 0);
 
        return (error);
 }
+ZPL_GETATTR_WRAPPER(zpl_getattr);
 
 static int
 zpl_setattr(struct dentry *dentry, struct iattr *ia)
index 7b9a0e21c66e683767c5b123c0bfad25ad69478b..3e11dd51e7665708d21b8762c64fc7b2258971c0 100644 (file)
 /* open_bdev_exclusive() is available */
 #undef HAVE_OPEN_BDEV_EXCLUSIVE
 
+/* iops->getattr() takes a path */
+#undef HAVE_PATH_IOPS_GETATTR
+
 /* iops->permission() exists */
 #undef HAVE_PERMISSION
 
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
+/* iops->getattr() takes a vfsmount */
+#undef HAVE_VFSMOUNT_IOPS_GETATTR
+
 /* fops->iterate() is available */
 #undef HAVE_VFS_ITERATE