Linux: 2.6.38: Adjust for permission inode operation changes
authorMarc Dionne <marc.c.dionne@gmail.com>
Sat, 29 Jan 2011 00:41:32 +0000 (19:41 -0500)
committerDerrick Brashear <shadow@dementia.org>
Wed, 9 Feb 2011 02:58:38 +0000 (18:58 -0800)
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

Change-Id: I42a171694717f4621f29f9f59e4f6049926862a3
Reviewed-on: http://gerrit.openafs.org/3770
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

acinclude.m4
src/afs/LINUX/osi_vnodeops.c
src/cf/linux-test4.m4

index 6ae09af..68a296d 100644 (file)
@@ -878,6 +878,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
index 657a317..abf4bf1 100644 (file)
@@ -2238,16 +2238,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;
index f9c8eda..5a87f74 100644 (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])
 ])