From owner-freebsd-hackers Sat Oct 2 15:11:15 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from mail.imp.ch (mail.imp.ch [157.161.1.2]) by hub.freebsd.org (Postfix) with ESMTP id 894241542C; Sat, 2 Oct 1999 15:10:40 -0700 (PDT) (envelope-from mb@imp.ch) Received: from mephisto.imp.ch (mb@mephisto.imp.ch [157.161.1.22]) by mail.imp.ch (8.9.3/8.9.3) with ESMTP id AAA18822; Sun, 3 Oct 1999 00:10:36 +0200 (MET DST) Received: from localhost (mb@localhost) by mephisto.imp.ch (8.9.3/8.9.3) with ESMTP id AAA05671; Sun, 3 Oct 1999 00:10:34 +0200 (MES) Date: Sun, 3 Oct 1999 00:10:34 +0200 From: Martin Blapp To: freebsd-hackers@freebsd.org Cc: cvs-committers@freebsd.org Subject: umount(8) or unmount(2) ? Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hi, Since about 5 weeks I'm working on sanity checks and bug fixes for umount(8), mount(8) and mount_xxx(8). Poul Henning told me to mail to cvs-committers too, cause many clued people read it. You'll find my patch and the readme for it on : http://www.attic.ch/patches/MOUNTPATCH-CURRENT-02101999-01 http://www.attic.ch/patches/MOUNTPATCH-README My problem is, that all fixes do their work. But it is not clear, if some work should be in kernel- or user-land. Some people just like to have umount(8) as a wrapper to unmount(2) and don't like umount(8) to do sanity checks. This is the case for this part of umount(8) I've replaced: - origname = name; - if (stat(name, &sb) < 0) { - mntpt = rname; - if ((getmntname(rname, MNTFROM, &type) == NULL) && - ((mntpt = getmntname(name, MNTON, &type)) == NULL)) { - warnx("%s: not currently mounted", name); - return (1); - } I've replaced stat() and realpath() on the mountpoint with () realpath on the basedir of the mointpoint and added some sanity checks. Most of my mount-order checks I added in umount(8) relay on a resolved mountpoint. I've implemented this as an idea from phk and it works very well. If we unmount a hanged nfs-mount - it hangs no in kernel (if busy), not in userland. This is a little step forward. Some side-effects of this part of my patch are, that some other PR's are fixed too : o [1999/02/03] bin/9893 NFS umount of regular file impossible s [1995/11/27] bin/841 stale nfs mounts cannot be umounted If we find the mntonname or mntfromname in the mounttable, we just go ahead and unmount it. No stat() or anything else is needed. Please tell me what you're thinking about these ideas and the work I've done and show me why I am wrong. Thank you very much ! Martin To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message