Whamcloud - gitweb
LU-812 llite: 3.0+ kernel fsync should call write
[fs/lustre-release.git] / lustre / llite / file.c
index f793d52..e988c81 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);
 }
 
@@ -2155,15 +2163,15 @@ int ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock)
         }
         flock.l_flock.pid = file_lock->fl_pid;
 
-        /* Somewhat ugly workaround for svc lockd.
-         * lockd installs custom fl_lmops->fl_compare_owner that checks
-         * for the fl_owner to be the same (which it always is on local node
-         * I guess between lockd processes) and then compares pid.
-         * As such we assign pid to the owner field to make it all work,
-         * conflict with normal locks is unlikely since pid space and
-         * pointer space for current->files are not intersecting */
-        if (file_lock->fl_lmops && file_lock->fl_lmops->fl_compare_owner)
-                flock.l_flock.owner = (unsigned long)file_lock->fl_pid;
+       /* Somewhat ugly workaround for svc lockd.
+        * lockd installs custom fl_lmops->lm_compare_owner that checks
+        * for the fl_owner to be the same (which it always is on local node
+        * I guess between lockd processes) and then compares pid.
+        * As such we assign pid to the owner field to make it all work,
+        * conflict with normal locks is unlikely since pid space and
+        * pointer space for current->files are not intersecting */
+       if (file_lock->fl_lmops && file_lock->fl_lmops->lm_compare_owner)
+               flock.l_flock.owner = (unsigned long)file_lock->fl_pid;
 
         switch (file_lock->fl_type) {
         case F_RDLCK:
@@ -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;