Index: src/core/org/apache/hadoop/fs/FSDataOutputStream.java
===================================================================
--- src/core/org/apache/hadoop/fs/FSDataOutputStream.java	(revision 745757)
+++ src/core/org/apache/hadoop/fs/FSDataOutputStream.java	(working copy)
@@ -74,7 +74,7 @@
 
   public FSDataOutputStream(OutputStream out, FileSystem.Statistics stats,
                             long startPosition) throws IOException {
-    super(new PositionCache(out, stats, startPosition));
+    super(new PositionCache(new BufferedOutputStream(out, 32*1024), stats, startPosition));
     wrappedStream = out;
   }
   
@@ -93,6 +93,7 @@
 
   /** {@inheritDoc} */
   public void sync() throws IOException {
+    flush(); // make sure the buffered output stream is flushed
     if (wrappedStream instanceof Syncable) {
       ((Syncable)wrappedStream).sync();
     }
