diff --git a/acinclude.m4 b/acinclude.m4 index b51ba9ca97..f4cc6420c2 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -876,6 +876,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) LINUX_INODE_SETATTR_RETURN_TYPE LINUX_IOP_I_CREATE_TAKES_NAMEIDATA LINUX_IOP_I_LOOKUP_TAKES_NAMEIDATA + LINUX_IOP_I_PERMISSION_TAKES_FLAGS LINUX_IOP_I_PERMISSION_TAKES_NAMEIDATA LINUX_IOP_I_PUT_LINK_TAKES_COOKIE LINUX_DOP_D_REVALIDATE_TAKES_NAMEIDATA diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index f74b1bb7a9..a741998811 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -2219,16 +2219,25 @@ done: * Check access rights - returns error if can't check or permission denied. */ static int -#ifdef IOP_PERMISSION_TAKES_NAMEIDATA +#if defined(IOP_PERMISSION_TAKES_FLAGS) +afs_linux_permission(struct inode *ip, int mode, unsigned int flags) +#elif defined(IOP_PERMISSION_TAKES_NAMEIDATA) afs_linux_permission(struct inode *ip, int mode, struct nameidata *nd) #else afs_linux_permission(struct inode *ip, int mode) #endif { int code; - cred_t *credp = crref(); + cred_t *credp; int tmp = 0; +#if defined(IOP_PERMISSION_TAKES_FLAGS) + /* We don't support RCU path walking */ + if (flags & IPERM_FLAG_RCU) + return -ECHILD; +#endif + + credp = crref(); AFS_GLOCK(); if (mode & MAY_EXEC) tmp |= VEXEC; diff --git a/src/cf/linux-test4.m4 b/src/cf/linux-test4.m4 index 4335e0cfb9..50814024f6 100644 --- a/src/cf/linux-test4.m4 +++ b/src/cf/linux-test4.m4 @@ -236,12 +236,24 @@ AC_DEFUN([LINUX_IOP_I_PERMISSION_TAKES_NAMEIDATA], [ [#include #include ], [struct inode _inode; -struct dentry _dentry; struct nameidata _nameidata; (void)_inode.i_op->permission(&_inode, 0, &_nameidata);], [IOP_PERMISSION_TAKES_NAMEIDATA], [define if your iops.permission takes a nameidata argument], - []) + [-Werror]) +]) + + +AC_DEFUN([LINUX_IOP_I_PERMISSION_TAKES_FLAGS], [ + AC_CHECK_LINUX_BUILD([whether inode_operations.permission takes flags], + [ac_cv_linux_func_i_permission_takes_flags], + [#include ], + [struct inode _inode; + unsigned int flags = 0; + (void)_inode.i_op->permission(&_inode, 0, flags);], + [IOP_PERMISSION_TAKES_FLAGS], + [define if your iops.permission takes a flags argument], + [-Werror]) ])