Skip to content

Commit 6eced02

Browse files
rincebraintonyhutter
authored andcommitted
Update tmpfile() existence detection
Linux changed the tmpfile() signature again in torvalds/linux@6521f89, which in turn broke our HAVE_TMPFILE detection in configure. Update that macro to include the new case, and change the signature of zpl_tmpfile as appropriate. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Rich Ercolani <[email protected]> Closes: #12060 Closes: #12087
1 parent 91c30dd commit 6eced02

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed

config/kernel-tmpfile.m4

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,43 @@ dnl # 3.11 API change
33
dnl # Add support for i_op->tmpfile
44
dnl #
55
AC_DEFUN([ZFS_AC_KERNEL_SRC_TMPFILE], [
6-
ZFS_LINUX_TEST_SRC([inode_operations_tmpfile], [
6+
dnl #
7+
dnl # 5.11 API change
8+
dnl # add support for userns parameter to tmpfile
9+
dnl #
10+
ZFS_LINUX_TEST_SRC([inode_operations_tmpfile_userns], [
711
#include <linux/fs.h>
8-
int tmpfile(struct inode *inode, struct dentry *dentry,
12+
int tmpfile(struct user_namespace *userns,
13+
struct inode *inode, struct dentry *dentry,
914
umode_t mode) { return 0; }
1015
static struct inode_operations
1116
iops __attribute__ ((unused)) = {
1217
.tmpfile = tmpfile,
1318
};
1419
],[])
20+
ZFS_LINUX_TEST_SRC([inode_operations_tmpfile], [
21+
#include <linux/fs.h>
22+
int tmpfile(struct inode *inode, struct dentry *dentry,
23+
umode_t mode) { return 0; }
24+
static struct inode_operations
25+
iops __attribute__ ((unused)) = {
26+
.tmpfile = tmpfile,
27+
};
28+
],[])
1529
])
1630

1731
AC_DEFUN([ZFS_AC_KERNEL_TMPFILE], [
1832
AC_MSG_CHECKING([whether i_op->tmpfile() exists])
19-
ZFS_LINUX_TEST_RESULT([inode_operations_tmpfile], [
33+
ZFS_LINUX_TEST_RESULT([inode_operations_tmpfile_userns], [
2034
AC_MSG_RESULT(yes)
2135
AC_DEFINE(HAVE_TMPFILE, 1, [i_op->tmpfile() exists])
36+
AC_DEFINE(HAVE_TMPFILE_USERNS, 1, [i_op->tmpfile() has userns])
2237
],[
23-
AC_MSG_RESULT(no)
38+
ZFS_LINUX_TEST_RESULT([inode_operations_tmpfile], [
39+
AC_MSG_RESULT(yes)
40+
AC_DEFINE(HAVE_TMPFILE, 1, [i_op->tmpfile() exists])
41+
],[
42+
AC_MSG_RESULT(no)
43+
])
2444
])
2545
])

module/os/linux/zfs/zpl_inode.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,12 @@ zpl_mknod(struct inode *dir, struct dentry *dentry, umode_t mode,
218218

219219
#ifdef HAVE_TMPFILE
220220
static int
221+
#ifdef HAVE_TMPFILE_USERNS
222+
zpl_tmpfile(struct user_namespace *userns, struct inode *dir,
223+
struct dentry *dentry, umode_t mode)
224+
#else
221225
zpl_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode)
226+
#endif
222227
{
223228
cred_t *cr = CRED();
224229
struct inode *ip;

0 commit comments

Comments
 (0)