Index: uspace/srv/fs/tmpfs/tmpfs_ops.c
===================================================================
--- uspace/srv/fs/tmpfs/tmpfs_ops.c	(revision ee1b8ca73ee74edd4f777249bab470594b67a438)
+++ uspace/srv/fs/tmpfs/tmpfs_ops.c	(revision 8d46bf27b72764b03b9aece443d751d5ee7f62fa)
@@ -346,10 +346,21 @@
 
 	/*
+	 * Check whether the file needs to grow.
+	 */
+	if (pos + size <= dentry->size) {
+		/* The file size is not changing. */
+		(void) ipc_data_write_deliver(callid, dentry->data + pos, size);
+		ipc_answer_1(rid, EOK, size);
+		return;
+	}
+	size_t delta = (pos + size) - dentry->size;
+	/*
 	 * At this point, we are deliberately extremely straightforward and
-	 * simply realloc the contents of the file on every write. In the end,
-	 * the situation might not be as bad as it may look: our heap allocator
-	 * can save us and just grow the block whenever possible.
-	 */
-	void *newdata = realloc(dentry->data, size);
+	 * simply realloc the contents of the file on every write that grows the
+	 * file. In the end, the situation might not be as bad as it may look:
+	 * our heap allocator can save us and just grow the block whenever
+	 * possible.
+	 */
+	void *newdata = realloc(dentry->data, dentry->size + delta);
 	if (!newdata) {
 		ipc_answer_0(callid, ENOMEM);
@@ -357,11 +368,7 @@
 		return;
 	}
-	dentry->size = size;
+	dentry->size += delta;
 	dentry->data = newdata;
 	(void) ipc_data_write_deliver(callid, dentry->data + pos, size);
-
-	/*
-	 * Answer the VFS_WRITE call.
-	 */
 	ipc_answer_1(rid, EOK, size);
 }
