Index: uspace/srv/vfs/vfs_ops.c
===================================================================
--- uspace/srv/vfs/vfs_ops.c	(revision 2a2fbc84d3b2a2ff06b9bb236ff8e813c17ce223)
+++ uspace/srv/vfs/vfs_ops.c	(revision 42d085927b86a7b4df96490eb9d3e6d0d6ca97eb)
@@ -734,5 +734,31 @@
 }
 
-static void vfs_rdwr(ipc_callid_t rid, ipc_call_t *request, bool read)
+typedef sysarg_t (* rdwr_ipc_cb_t)(async_exch_t *, vfs_file_t *, ipc_call_t *,
+    bool, void *);
+
+static sysarg_t rdwr_ipc_client(async_exch_t *exch, vfs_file_t *file,
+    ipc_call_t *answer, bool read, void *data)
+{
+	/*
+	 * Make a VFS_READ/VFS_WRITE request at the destination FS server
+	 * and forward the IPC_M_DATA_READ/IPC_M_DATA_WRITE request to the
+	 * destination FS server. The call will be routed as if sent by
+	 * ourselves. Note that call arguments are immutable in this case so we
+	 * don't have to bother.
+	 */
+
+	if (read) {
+		return async_data_read_forward_4_1(exch, VFS_OUT_READ,
+		    file->node->service_id, file->node->index,
+		    LOWER32(file->pos), UPPER32(file->pos), answer);
+	} else {
+		return async_data_write_forward_4_1(exch, VFS_OUT_WRITE,
+		    file->node->service_id, file->node->index,
+		    LOWER32(file->pos), UPPER32(file->pos), answer);
+	}	
+}
+	
+static void vfs_rdwr(ipc_callid_t rid, ipc_call_t *request, bool read,
+    rdwr_ipc_cb_t ipc_cb, void *ipc_cb_data)
 {
 	/*
@@ -786,25 +812,12 @@
 	async_exch_t *fs_exch = vfs_exchange_grab(file->node->fs_handle);
 	
-	/*
-	 * Make a VFS_READ/VFS_WRITE request at the destination FS server
-	 * and forward the IPC_M_DATA_READ/IPC_M_DATA_WRITE request to the
-	 * destination FS server. The call will be routed as if sent by
-	 * ourselves. Note that call arguments are immutable in this case so we
-	 * don't have to bother.
-	 */
-	sysarg_t rc;
+	if (!read && file->append)
+		file->pos = file->node->size;
+	
+	/*
+	 * Handle communication with the endpoint FS.
+	 */
 	ipc_call_t answer;
-	if (read) {
-		rc = async_data_read_forward_4_1(fs_exch, VFS_OUT_READ,
-		    file->node->service_id, file->node->index,
-		    LOWER32(file->pos), UPPER32(file->pos), &answer);
-	} else {
-		if (file->append)
-			file->pos = file->node->size;
-		
-		rc = async_data_write_forward_4_1(fs_exch, VFS_OUT_WRITE,
-		    file->node->service_id, file->node->index,
-		    LOWER32(file->pos), UPPER32(file->pos), &answer);
-	}
+	sysarg_t rc = ipc_cb(fs_exch, file, &answer, read, ipc_cb_data);
 	
 	vfs_exchange_release(fs_exch);
@@ -842,10 +855,10 @@
 void vfs_read(ipc_callid_t rid, ipc_call_t *request)
 {
-	vfs_rdwr(rid, request, true);
+	vfs_rdwr(rid, request, true, rdwr_ipc_client, NULL);
 }
 
 void vfs_write(ipc_callid_t rid, ipc_call_t *request)
 {
-	vfs_rdwr(rid, request, false);
+	vfs_rdwr(rid, request, false, rdwr_ipc_client, NULL);
 }
 
