Index: uspace/lib/libc/include/ipc/vfs.h
===================================================================
--- uspace/lib/libc/include/ipc/vfs.h	(revision c1a8e5e6db663f724f0c5446f748c2e402163dfb)
+++ uspace/lib/libc/include/ipc/vfs.h	(revision 4b995b928b92b05c010dd867dc13735846a46649)
@@ -148,4 +148,11 @@
 #define L_OPEN  64
 
+/**
+ * L_NOCROSS_LAST_MP is used exclusively during the VFS_IN_UNMOUNT operation. It
+ * tells the lookup routine not to cross the last mount point in the lookup
+ * path.
+ */
+#define L_NOCROSS_LAST_MP	128
+
 #endif
 
Index: uspace/lib/libfs/libfs.c
===================================================================
--- uspace/lib/libfs/libfs.c	(revision c1a8e5e6db663f724f0c5446f748c2e402163dfb)
+++ uspace/lib/libfs/libfs.c	(revision 4b995b928b92b05c010dd867dc13735846a46649)
@@ -304,5 +304,16 @@
 		on_error(rc, goto out_with_answer);
 		
-		if ((tmp) && (tmp->mp_data.mp_active)) {
+		/*
+		 * If the matching component is a mount point, there are two
+		 * legitimate semantics of the lookup operation. The first is
+		 * the commonly used one in which the lookup crosses each mount
+		 * point into the mounted file system. The second semantics is
+		 * used mostly during unmount() and differs from the first one
+		 * only in that the last mount point in the looked up path,
+		 * which is also its last component, is not crossed.
+		 */
+
+		if ((tmp) && (tmp->mp_data.mp_active) &&
+		    (!(lflag & L_NOCROSS_LAST_MP) || (next <= last))) {
 			if (next > last)
 				next = last = first;
Index: uspace/srv/vfs/vfs_ops.c
===================================================================
--- uspace/srv/vfs/vfs_ops.c	(revision c1a8e5e6db663f724f0c5446f748c2e402163dfb)
+++ uspace/srv/vfs/vfs_ops.c	(revision 4b995b928b92b05c010dd867dc13735846a46649)
@@ -459,9 +459,10 @@
 	/*
 	 * Make sure that we are called with exactly one of L_FILE and
-	 * L_DIRECTORY. Make sure that the user does not pass L_OPEN.
+	 * L_DIRECTORY. Make sure that the user does not pass L_OPEN or
+	 * L_NOCROSS_LAST_MP.
 	 */
 	if (((lflag & (L_FILE | L_DIRECTORY)) == 0) ||
 	    ((lflag & (L_FILE | L_DIRECTORY)) == (L_FILE | L_DIRECTORY)) ||
-	    ((lflag & L_OPEN) != 0)) {
+	    (lflag & L_OPEN) || (lflag & L_NOCROSS_LAST_MP)) {
 		ipc_answer_0(rid, EINVAL);
 		return;
