Linux: 3.1: update RCU path walking detection in permission i_op
[openafs.git] / src / afs / LINUX / osi_vnodeops.c
index 57dc081..18be0ff 100644 (file)
@@ -502,6 +502,8 @@ afs_linux_release(struct inode *ip, struct file *fp)
 static int
 #if defined(FOP_FSYNC_TAKES_DENTRY)
 afs_linux_fsync(struct file *fp, struct dentry *dp, int datasync)
+#elif defined(FOP_FSYNC_TAKES_RANGE)
+afs_linux_fsync(struct file *fp, loff_t start, loff_t end, int datasync)
 #else
 afs_linux_fsync(struct file *fp, int datasync)
 #endif
@@ -510,9 +512,15 @@ afs_linux_fsync(struct file *fp, int datasync)
     struct inode *ip = FILE_INODE(fp);
     cred_t *credp = crref();
 
+#if defined(FOP_FSYNC_TAKES_RANGE)
+    mutex_lock(&ip->i_mutex);
+#endif
     AFS_GLOCK();
     code = afs_fsync(VTOAFS(ip), credp);
     AFS_GUNLOCK();
+#if defined(FOP_FSYNC_TAKES_RANGE)
+    mutex_unlock(&ip->i_mutex);
+#endif
     crfree(credp);
     return afs_convert_code(code);
 
@@ -1053,7 +1061,11 @@ afs_dentry_iput(struct dentry *dp, struct inode *ip)
 }
 
 static int
+#if defined(DOP_D_DELETE_TAKES_CONST)
+afs_dentry_delete(const struct dentry *dp)
+#else
 afs_dentry_delete(struct dentry *dp)
+#endif
 {
     if (dp->d_inode && (VTOAFS(dp->d_inode)->f.states & CUnlinked))
        return 1;               /* bad inode? */
@@ -2342,10 +2354,13 @@ afs_linux_permission(struct inode *ip, int mode)
     cred_t *credp;
     int tmp = 0;
 
+    /* Check for RCU path walking */
 #if defined(IOP_PERMISSION_TAKES_FLAGS)
-    /* We don't support RCU path walking */
     if (flags & IPERM_FLAG_RCU)
        return -ECHILD;
+#elif defined(MAY_NOT_BLOCK)
+    if (mode & MAY_NOT_BLOCK)
+       return -ECHILD;
 #endif
 
     credp = crref();