From vova@express.ru  Mon Oct 22 07:35:06 2001
Return-Path: <vova@express.ru>
Received: from vbook.express.ru (asplinux.ru [195.133.213.194])
	by hub.freebsd.org (Postfix) with ESMTP id DFC7837B401
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 22 Oct 2001 07:35:04 -0700 (PDT)
Received: from vova by vbook.express.ru with local (Exim 3.31 #2)
	id 15vgBD-00018e-00
	for FreeBSD-gnats-submit@freebsd.org; Mon, 22 Oct 2001 18:35:51 +0400
Message-Id: <E15vgBD-00018e-00@vbook.express.ru>
Date: Mon, 22 Oct 2001 18:35:51 +0400
From: Vladimir B.Grebenschikov <vova@express.ru>
Sender: "Vladimir B. Grebenschikov" <vova@express.ru>
Reply-To: Vladimir B.Grebenschikov <vova@express.ru>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: umount(8) and unmount(2) don't corespond by semantic
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         31432
>Category:       bin
>Synopsis:       umount(8) and unmount(2) don't corespond by semantic
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Oct 22 07:40:00 PDT 2001
>Closed-Date:    Mon May 15 06:35:56 GMT 2006
>Last-Modified:  Mon May 15 06:35:56 GMT 2006
>Originator:     Vladimir B. Grebenschikov
>Release:        FreeBSD 5.0-CURRENT i386, FreeBSD 4.4-RELEASE i386
>Organization:
SW Soft
>Environment:
System: FreeBSD vbook.express.ru 5.0-CURRENT FreeBSD 5.0-CURRENT #8: Mon Oct 22 11:34:30 MSD 2001 vova@walder:/usr/obj/ext/current/src/sys/VBOOK i386

>Description:

 umount(8) first tries to lookup a mountpoint in result list returned by
 getfsstat() then, if found, calls unmount(2).
 If any directory component above mountpoint was renamed, it is not possible
 to unmount this mountpoint because lookup fails.

So unmount(2) needs real directory corresponding to the mountpoint to be
unmounted, but umount(8) tries to compare it with list of paths saved by
mount(2) and fails in case of rename.

>How-To-Repeat:

# mount -t linprocfs none /tmp/x/y
# mv /tmp/x /tmp/z
# umount /tmp/z/y
umount: /tmp/z/y not found in mount table, unmounted it anyway
# umount /tmp/x/y
umount: unmount of /usr/tmp/x/y failed: No such file or directory
# cat > um.c
main(int ac, char **av) {
unmount(av[1], 0);
}
^D
# gcc um.c
# ./a.out /tmp/z/y
# mount | grep linproc
#
	

>Fix:

Remove getfsstat() lookup in umount(8).

>Release-Note:
>Audit-Trail:

From: Martin Blapp <mb@imp.ch>
To: freebsd-gnats-submit@FreeBSD.org, vova@express.ru
Cc:  
Subject: Re: bin/31432: umount(8) and unmount(2) don't corespond by semantic
Date: Mon, 22 Oct 2001 17:41:37 +0200

 This is not a bug.
 
 You can unmount a mounted filesytem by:
 
 1. the mounted directory
 2. the mounted name.
 
 It is clear that  if you rename a mountpoint, that you can't unmount it
 by the name
 itself.
 
 The checks umount(8) does, are rather complex. umount(8) does a check,
 if
 the mounted name matches the original mountpoint. We need this to handle
 
 overlay mounts properly. Your suggestion does break overlay mounts
 unmounting
 order !
 
 If it is not possible to unmount like in your example, you have to
 unmount the
 mounted name:
 
 umount linprocfs
 
 That's it.
 
 Martin
 
 
 -- Martin Blapp, mb@imp.ch
 ------------------------------------------------------------------
 Improware AG, UNIX solution and service provider
 Zurlindenstrasse 29, 4133 Pratteln, Switzerland
 Phone: +41 061 826 93 00: +41 61 826 93 01
 PGP Fingerprint: 57E 7CCD 2769 E7AC C5FA  DF2C 19C6 DCD1 1B3A EC9C
 ------------------------------------------------------------------
 
 
 
State-Changed-From-To: open->closed 
State-Changed-By: rodrigc 
State-Changed-When: Mon May 15 06:35:29 UTC 2006 
State-Changed-Why:  
Not a bug, as described by Martin Blapp. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=31432 
>Unformatted:
