summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2018-09-24 17:11:25 -0700
committerGitHub <[email protected]>2018-09-24 17:11:25 -0700
commite897a23eb13bafcf9c38d2fc37ae57a7729d9a02 (patch)
treec0370c4ecee2e54a40a5e4a273bee72ecdca8220 /config
parent36e369ecb847570d6939073663c4e95406223c7f (diff)
Fix statfs(2) for 32-bit user space
When handling a 32-bit statfs() system call the returned fields, although 64-bit in the kernel, must be limited to 32-bits or an EOVERFLOW error will be returned. This is less of an issue for block counts since the default reported block size in 128KiB. But since it is possible to set a smaller block size, these values will be scaled as needed to fit in a 32-bit unsigned long. Unlike most other filesystems the total possible file counts are more likely to overflow because they are calculated based on the available free space in the pool. In order to prevent this the reported value must be capped at 2^32-1. This is only for statfs(2) reporting, there are no changes to the internal ZFS limits. Reviewed-by: Andreas Dilger <[email protected]> Reviewed-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #7927 Closes #7122 Closes #7937
Diffstat (limited to 'config')
-rw-r--r--config/kernel-in-compat-syscall.m420
-rw-r--r--config/kernel.m41
2 files changed, 21 insertions, 0 deletions
diff --git a/config/kernel-in-compat-syscall.m4 b/config/kernel-in-compat-syscall.m4
new file mode 100644
index 000000000..9fca9da20
--- /dev/null
+++ b/config/kernel-in-compat-syscall.m4
@@ -0,0 +1,20 @@
+dnl #
+dnl # 4.5 API change
+dnl # Added in_compat_syscall() which can be overridden on a per-
+dnl # architecture basis. Prior to this is_compat_task() was the
+dnl # provided interface.
+dnl #
+AC_DEFUN([ZFS_AC_KERNEL_IN_COMPAT_SYSCALL], [
+ AC_MSG_CHECKING([whether in_compat_syscall() is available])
+ ZFS_LINUX_TRY_COMPILE([
+ #include <linux/compat.h>
+ ],[
+ in_compat_syscall();
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_IN_COMPAT_SYSCALL, 1,
+ [in_compat_syscall() is available])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+])
diff --git a/config/kernel.m4 b/config/kernel.m4
index 7b92c4744..118f1d8dc 100644
--- a/config/kernel.m4
+++ b/config/kernel.m4
@@ -160,6 +160,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
ZFS_AC_KERNEL_GLOBAL_PAGE_STATE
ZFS_AC_KERNEL_ACL_HAS_REFCOUNT
ZFS_AC_KERNEL_USERNS_CAPABILITIES
+ ZFS_AC_KERNEL_IN_COMPAT_SYSCALL
AS_IF([test "$LINUX_OBJ" != "$LINUX"], [
KERNEL_MAKE="$KERNEL_MAKE O=$LINUX_OBJ"