Index: uspace/srv/fs/tmpfs/tmpfs.c
===================================================================
--- uspace/srv/fs/tmpfs/tmpfs.c	(revision 07e01e6a3438b23b858b7b7c85714f1f17331052)
+++ uspace/srv/fs/tmpfs/tmpfs.c	(revision fdb779590942e6ca9d222d9235582c06c4870af2)
@@ -61,5 +61,5 @@
 		[IPC_METHOD_TO_VFS_OP(VFS_MOUNT)] = VFS_OP_NULL,
 		[IPC_METHOD_TO_VFS_OP(VFS_UNMOUNT)] = VFS_OP_NULL,
-		[IPC_METHOD_TO_VFS_OP(VFS_FREE)] = VFS_OP_DEFINED,
+		[IPC_METHOD_TO_VFS_OP(VFS_DESTROY)] = VFS_OP_DEFINED,
 	}
 };
@@ -116,6 +116,6 @@
 			tmpfs_truncate(callid, &call);
 			break;
-		case VFS_FREE:
-			tmpfs_free(callid, &call);
+		case VFS_DESTROY:
+			tmpfs_destroy(callid, &call);
 			break;
 		default:
Index: uspace/srv/fs/tmpfs/tmpfs.h
===================================================================
--- uspace/srv/fs/tmpfs/tmpfs.h	(revision 07e01e6a3438b23b858b7b7c85714f1f17331052)
+++ uspace/srv/fs/tmpfs/tmpfs.h	(revision fdb779590942e6ca9d222d9235582c06c4870af2)
@@ -65,5 +65,5 @@
 extern void tmpfs_write(ipc_callid_t, ipc_call_t *);
 extern void tmpfs_truncate(ipc_callid_t, ipc_call_t *);
-extern void tmpfs_free(ipc_callid_t, ipc_call_t *);
+extern void tmpfs_destroy(ipc_callid_t, ipc_call_t *);
 
 #endif
Index: uspace/srv/fs/tmpfs/tmpfs_ops.c
===================================================================
--- uspace/srv/fs/tmpfs/tmpfs_ops.c	(revision 07e01e6a3438b23b858b7b7c85714f1f17331052)
+++ uspace/srv/fs/tmpfs/tmpfs_ops.c	(revision fdb779590942e6ca9d222d9235582c06c4870af2)
@@ -62,7 +62,11 @@
 #define TMPFS_GET_LNKCNT(x)	1
 
-/*
- * Hash table of all directory entries.
- */
+/* Forward declarations of static functions. */
+static void *create_node(int);
+static bool link_node(void *, void *, const char *);
+static int unlink_node(void *);
+static void destroy_node(void *);
+
+/** Hash table of all directory entries. */
 hash_table_t dentries;
 
@@ -116,15 +120,6 @@
 	if (!hash_table_create(&dentries, DENTRIES_BUCKETS, 1, &dentries_ops))
 		return false;
-
-	root = (tmpfs_dentry_t *) malloc(sizeof(tmpfs_dentry_t));
-	if (!root)
-		return false;
-	tmpfs_dentry_initialize(root);
-	root->index = tmpfs_next_index++;
-	root->name = "";
-	root->type = TMPFS_DIRECTORY;
-	hash_table_insert(&dentries, &root->index, &root->dh_link);
-
-	return true;
+	root = (tmpfs_dentry_t *) create_node(L_DIRECTORY);
+	return root != NULL;
 }
 
@@ -143,10 +138,6 @@
 }
 
-static void *create_node(void *nodep,
-    const char *component, int lflag)
-{
-	tmpfs_dentry_t *dentry = (tmpfs_dentry_t *) nodep;
-
-	assert(dentry->type == TMPFS_DIRECTORY);
+void *create_node(int lflag)
+{
 	assert((lflag & L_FILE) ^ (lflag & L_DIRECTORY));
 
@@ -154,16 +145,7 @@
 	if (!node)
 		return NULL;
-	size_t len = strlen(component);
-	char *name = malloc(len + 1);
-	if (!name) {
-		free(node);
-		return NULL;
-	}
-	strcpy(name, component);
 
 	tmpfs_dentry_initialize(node);
 	node->index = tmpfs_next_index++;
-	node->name = name;
-	node->parent = dentry;
 	if (lflag & L_DIRECTORY) 
 		node->type = TMPFS_DIRECTORY;
@@ -171,14 +153,4 @@
 		node->type = TMPFS_FILE;
 
-	/* Insert the new node into the namespace. */
-	if (dentry->child) {
-		tmpfs_dentry_t *tmp = dentry->child;
-		while (tmp->sibling)
-			tmp = tmp->sibling;
-		tmp->sibling = node;
-	} else {
-		dentry->child = node;
-	}
-
 	/* Insert the new node into the dentry hash table. */
 	hash_table_insert(&dentries, &node->index, &node->dh_link);
@@ -186,5 +158,33 @@
 }
 
-static int destroy_component(void *nodeptr)
+bool link_node(void *prnt, void *chld, const char *nm)
+{
+	tmpfs_dentry_t *parentp = (tmpfs_dentry_t *) prnt;
+	tmpfs_dentry_t *childp = (tmpfs_dentry_t *) chld;
+
+	assert(parentp->type == TMPFS_DIRECTORY);
+
+	size_t len = strlen(nm);
+	char *name = malloc(len + 1);
+	if (!name)
+		return false;
+	strcpy(name, nm);
+	childp->name = name;
+
+	/* Insert the new node into the namespace. */
+	if (parentp->child) {
+		tmpfs_dentry_t *tmp = parentp->child;
+		while (tmp->sibling)
+			tmp = tmp->sibling;
+		tmp->sibling = childp;
+	} else {
+		parentp->child = childp;
+	}
+	childp->parent = parentp;
+
+	return true;
+}
+
+int unlink_node(void *nodeptr)
 {
 	tmpfs_dentry_t *dentry = (tmpfs_dentry_t *)nodeptr;
@@ -208,5 +208,23 @@
 	dentry->parent = NULL;
 
+	free(dentry->name);
+	dentry->name = NULL;
+
 	return EOK;
+}
+
+void destroy_node(void *nodep)
+{
+	tmpfs_dentry_t *dentry = (tmpfs_dentry_t *) nodep;
+	
+	assert(!dentry->child);
+	assert(!dentry->sibling);
+
+	unsigned long index = dentry->index;
+	hash_table_remove(&dentries, &index, 1);
+
+	if (dentry->type == TMPFS_FILE)
+		free(dentry->data);
+	free(dentry);
 }
 
@@ -269,11 +287,17 @@
 					return;
 				} 
-				void *nodep = create_node(dcur,
-				    component, lflag);
+				void *nodep = create_node(lflag);
 				if (nodep) {
-					ipc_answer_5(rid, EOK,
-					    tmpfs_reg.fs_handle, dev_handle,
-					    TMPFS_GET_INDEX(nodep), 0,
-					    TMPFS_GET_LNKCNT(nodep));
+					if (!link_node(dcur, nodep,
+					    component)) {
+						destroy_node(nodep);
+						ipc_answer_0(rid, ENOSPC);
+					} else {
+						ipc_answer_5(rid, EOK,
+						    tmpfs_reg.fs_handle,
+						    dev_handle,
+						    TMPFS_GET_INDEX(nodep), 0,
+						    TMPFS_GET_LNKCNT(nodep));
+					}
 				} else {
 					ipc_answer_0(rid, ENOSPC);
@@ -317,9 +341,15 @@
 			len = 0;
 				
-			void *nodep = create_node(dcur, component, lflag);
+			void *nodep = create_node(lflag);
 			if (nodep) {
-				ipc_answer_5(rid, EOK, tmpfs_reg.fs_handle,
-				    dev_handle, TMPFS_GET_INDEX(nodep), 0,
-				    TMPFS_GET_LNKCNT(nodep));
+				if (!link_node(dcur, nodep, component)) {
+					destroy_node(nodep);
+					ipc_answer_0(rid, ENOSPC);
+				} else {
+					ipc_answer_5(rid, EOK,
+					    tmpfs_reg.fs_handle,
+					    dev_handle, TMPFS_GET_INDEX(nodep),
+					    0, TMPFS_GET_LNKCNT(nodep));
+				}
 			} else {
 				ipc_answer_0(rid, ENOSPC);
@@ -334,5 +364,5 @@
 	if (lflag & L_DESTROY) {
 		unsigned old_lnkcnt = TMPFS_GET_LNKCNT(dcur);
-		int res = destroy_component(dcur);
+		int res = unlink_node(dcur);
 		ipc_answer_5(rid, (ipcarg_t)res, tmpfs_reg.fs_handle,
 		    dev_handle, dcur->index, dcur->size, old_lnkcnt);
@@ -519,5 +549,5 @@
 }
 
-void tmpfs_free(ipc_callid_t rid, ipc_call_t *request)
+void tmpfs_destroy(ipc_callid_t rid, ipc_call_t *request)
 {
 	int dev_handle = IPC_GET_ARG1(*request);
@@ -532,16 +562,5 @@
 	tmpfs_dentry_t *dentry = hash_table_get_instance(hlp, tmpfs_dentry_t,
 	    dh_link);
-	
-	assert(!dentry->parent);
-	assert(!dentry->child);
-	assert(!dentry->sibling);
-
-	hash_table_remove(&dentries, &index, 1);
-
-	if (dentry->type == TMPFS_FILE)
-		free(dentry->data);
-	free(dentry->name);
-	free(dentry);
-
+	destroy_node(dentry);
 	ipc_answer_0(rid, EOK);
 }
Index: uspace/srv/vfs/vfs.h
===================================================================
--- uspace/srv/vfs/vfs.h	(revision 07e01e6a3438b23b858b7b7c85714f1f17331052)
+++ uspace/srv/vfs/vfs.h	(revision fdb779590942e6ca9d222d9235582c06c4870af2)
@@ -58,5 +58,5 @@
 typedef enum {
 	VFS_LOOKUP = VFS_LAST_CMN,
-	VFS_FREE,
+	VFS_DESTROY,
 	VFS_LAST_CLNT,	/* keep this the last member of this enum */
 } vfs_request_clnt_t;
Index: uspace/srv/vfs/vfs_node.c
===================================================================
--- uspace/srv/vfs/vfs_node.c	(revision 07e01e6a3438b23b858b7b7c85714f1f17331052)
+++ uspace/srv/vfs/vfs_node.c	(revision fdb779590942e6ca9d222d9235582c06c4870af2)
@@ -132,6 +132,6 @@
 		int phone = vfs_grab_phone(node->fs_handle);
 		ipcarg_t rc;
-		rc = async_req_2_0(phone, VFS_FREE, (ipcarg_t)node->dev_handle,
-		    (ipcarg_t)node->index);
+		rc = async_req_2_0(phone, VFS_DESTROY,
+		    (ipcarg_t)node->dev_handle, (ipcarg_t)node->index);
 		assert(rc == EOK);
 		vfs_release_phone(phone);
Index: uspace/srv/vfs/vfs_ops.c
===================================================================
--- uspace/srv/vfs/vfs_ops.c	(revision 07e01e6a3438b23b858b7b7c85714f1f17331052)
+++ uspace/srv/vfs/vfs_ops.c	(revision fdb779590942e6ca9d222d9235582c06c4870af2)
@@ -678,5 +678,5 @@
 	 * The name has already been unlinked by vfs_lookup_internal().
 	 * We have to get and put the VFS node to ensure that it is
-	 * VFS_FREE'd after the last reference to it is dropped.
+	 * VFS_DESTROY'ed after the last reference to it is dropped.
 	 */
 	vfs_node_t *node = vfs_node_get(&lr);
