Whamcloud - gitweb
LU-1337 llite: ll_inode_permission should check RCU walk
[fs/lustre-release.git] / lustre / llite / file.c
index d03ec76..e43dfb5 100644 (file)
@@ -2078,9 +2078,14 @@ int ll_fsync(struct file *file, struct dentry *dentry, int data)
                inode->i_generation, inode);
         ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_FSYNC, 1);
 
+#ifdef HAVE_FILE_FSYNC_4ARGS
+       rc = filemap_write_and_wait_range(inode->i_mapping, start, end);
+       mutex_lock(&inode->i_mutex);
+#else
         /* fsync's caller has already called _fdata{sync,write}, we want
          * that IO to finish before calling the osc and mdc sync methods */
         rc = filemap_fdatawait(inode->i_mapping);
+#endif
 
         /* catch async errors that were recorded back when async writeback
          * failed for pages in this mapping. */
@@ -2118,6 +2123,9 @@ int ll_fsync(struct file *file, struct dentry *dentry, int data)
        }
        ccc_inode_lsm_put(inode, lsm);
 
+#ifdef HAVE_FILE_FSYNC_4ARGS
+       mutex_unlock(&inode->i_mutex);
+#endif
        RETURN(rc);
 }
 
@@ -2488,7 +2496,7 @@ int ll_getattr_it(struct vfsmount *mnt, struct dentry *de,
         stat->nlink = inode->i_nlink;
         stat->uid = inode->i_uid;
         stat->gid = inode->i_gid;
-        stat->rdev = kdev_t_to_nr(inode->i_rdev);
+       stat->rdev = inode->i_rdev;
         stat->atime = inode->i_atime;
         stat->mtime = inode->i_mtime;
         stat->ctime = inode->i_ctime;
@@ -2589,7 +2597,10 @@ int ll_inode_permission(struct inode *inode, int mask, struct nameidata *nd)
         int rc = 0;
         ENTRY;
 
-#ifdef HAVE_GENERIC_PERMISSION_4ARGS
+#ifdef MAY_NOT_BLOCK
+       if (mask & MAY_NOT_BLOCK)
+               return -ECHILD;
+#elif defined(HAVE_GENERIC_PERMISSION_4ARGS)
        if (flags & IPERM_FLAG_RCU)
                return -ECHILD;
 #endif