fs: push i_mutex and filemap_write_and_wait down into ->fsync() handlers
[deliverable/linux.git] / fs / ceph / caps.c
index f605753c8fe9b20aa4d2f165b57534d1d9b3fe78..8d74ad7ba556624c4eb80e1f598ac908e5356d04 100644 (file)
@@ -1811,7 +1811,7 @@ out:
        spin_unlock(&ci->i_unsafe_lock);
 }
 
-int ceph_fsync(struct file *file, int datasync)
+int ceph_fsync(struct file *file, loff_t start, loff_t end, int datasync)
 {
        struct inode *inode = file->f_mapping->host;
        struct ceph_inode_info *ci = ceph_inode(inode);
@@ -1822,9 +1822,10 @@ int ceph_fsync(struct file *file, int datasync)
        dout("fsync %p%s\n", inode, datasync ? " datasync" : "");
        sync_write_wait(inode);
 
-       ret = filemap_write_and_wait(inode->i_mapping);
+       ret = filemap_write_and_wait_range(inode->i_mapping, start, end);
        if (ret < 0)
                return ret;
+       mutex_lock(&inode->i_mutex);
 
        dirty = try_flush_caps(inode, NULL, &flush_tid);
        dout("fsync dirty caps are %s\n", ceph_cap_string(dirty));
@@ -1841,6 +1842,7 @@ int ceph_fsync(struct file *file, int datasync)
        }
 
        dout("fsync %p%s done\n", inode, datasync ? " datasync" : "");
+       mutex_unlock(&inode->i_mutex);
        return ret;
 }
 
This page took 0.066286 seconds and 5 git commands to generate.