Linux: 2.6.38: Adjust for permission inode operation changes

The permission i_op has a new signature with a flags argument, and
must now deal with RCU path walking.
- Fix existing configure test for this i_op, it succeeds when it
shouldn't
- Add a new configure test for the new signature
- Make our permission i_op "RCU-walk aware" - return ECHILD if
called in that mode

Reviewed-on: http://gerrit.openafs.org/3770
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit 5bcc0ea735ea519298c98b46c66bf1326cdee5e4)

Change-Id: Ia47dfe390ea317925acfca709dbd637b68e94ca8
Reviewed-on: http://gerrit.openafs.org/3917
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
Marc Dionne 2011-01-28 19:41:32 -05:00 committed by Derrick Brashear
parent 5d370e4533
commit af5e870f59
3 changed files with 26 additions and 4 deletions

View File

@ -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

View File

@ -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;

View File

@ -236,12 +236,24 @@ AC_DEFUN([LINUX_IOP_I_PERMISSION_TAKES_NAMEIDATA], [
[#include <linux/fs.h>
#include <linux/namei.h>],
[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 <linux/fs.h>],
[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])
])