Linux 3.3: use umode_t for mkdir and create inode ops
[openafs.git] / src / afs / LINUX / osi_vnodeops.c
index 57dc081..ae17006 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);
 
@@ -725,6 +733,11 @@ struct file_operations afs_dir_fops = {
   .open =      afs_linux_open,
   .release =   afs_linux_release,
   .llseek =    default_llseek,
+#ifdef HAVE_LINUX_NOOP_FSYNC
+  .fsync =     noop_fsync,
+#else
+  .fsync =     simple_sync_file,
+#endif
 };
 
 struct file_operations afs_file_fops = {
@@ -1053,7 +1066,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? */
@@ -1080,12 +1097,17 @@ struct dentry_operations afs_dentry_operations = {
  * name is in kernel space at this point.
  */
 static int
+#if defined(IOP_MKDIR_TAKES_UMODE_T)
+afs_linux_create(struct inode *dip, struct dentry *dp, umode_t mode,
+                struct nameidata *nd)
+#else
 #ifdef IOP_CREATE_TAKES_NAMEIDATA
 afs_linux_create(struct inode *dip, struct dentry *dp, int mode,
                 struct nameidata *nd)
 #else
 afs_linux_create(struct inode *dip, struct dentry *dp, int mode)
 #endif
+#endif
 {
     struct vattr vattr;
     cred_t *credp = crref();
@@ -1313,7 +1335,11 @@ afs_linux_symlink(struct inode *dip, struct dentry *dp, const char *target)
 }
 
 static int
+#if defined(IOP_MKDIR_TAKES_UMODE_T)
+afs_linux_mkdir(struct inode *dip, struct dentry *dp, umode_t mode)
+#else
 afs_linux_mkdir(struct inode *dip, struct dentry *dp, int mode)
+#endif
 {
     int code;
     cred_t *credp = crref();
@@ -2342,10 +2368,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();