Skip to content

Commit d09d74c

Browse files
committed
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. Closes: #12060 Signed-off-by: Rich Ercolani <[email protected]>
1 parent 7457b02 commit d09d74c

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
@@ -224,7 +224,12 @@ zpl_mknod(struct inode *dir, struct dentry *dentry, umode_t mode,
224224

225225
#ifdef HAVE_TMPFILE
226226
static int
227+
#ifdef HAVE_TMPFILE_USERNS
228+
zpl_tmpfile(struct user_namespace *userns, struct inode *dir,
229+
struct dentry *dentry, umode_t mode)
230+
#else
227231
zpl_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode)
232+
#endif
228233
{
229234
cred_t *cr = CRED();
230235
struct inode *ip;

0 commit comments

Comments
 (0)