Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
[sfrench/cifs-2.6.git] / fs / block_dev.c
index 8bed0557d88c17ac9600a179f8127d855e509bab..73d6a735b8f311cc62fe5b22c626a7a4baa9c452 100644 (file)
@@ -405,7 +405,17 @@ static loff_t block_llseek(struct file *file, loff_t offset, int origin)
  
 static int block_fsync(struct file *filp, struct dentry *dentry, int datasync)
 {
-       return sync_blockdev(I_BDEV(filp->f_mapping->host));
+       struct block_device *bdev = I_BDEV(filp->f_mapping->host);
+       int error;
+
+       error = sync_blockdev(bdev);
+       if (error)
+               return error;
+       
+       error = blkdev_issue_flush(bdev, NULL);
+       if (error == -EOPNOTSUPP)
+               error = 0;
+       return error;
 }
 
 /*