Index: uspace/lib/libfs/libfs.c
===================================================================
--- uspace/lib/libfs/libfs.c	(revision cf240cbc0d420fb62b7b3b5c41946295fe7ff11a)
+++ uspace/lib/libfs/libfs.c	(revision e095644fa3dee2172f750ac4b6c58a572cec9c46)
@@ -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;
