NetBSD Problem Report #39770

From kre@munnari.OZ.AU  Sun Oct 19 20:43:20 2008
Return-Path: <kre@munnari.OZ.AU>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id DE5A163B88A
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 19 Oct 2008 20:43:19 +0000 (UTC)
Message-Id: <200810192043.m9JKhB4s007070@jade.coe.psu.ac.th>
Date: Mon, 20 Oct 2008 03:43:11 +0700 (ICT)
From: kre@munnari.OZ.AU
To: gnats-bugs@gnats.NetBSD.org
Subject: mount(2) doc enhancements
X-Send-Pr-Version: 3.95

>Number:         39770
>Category:       kern
>Synopsis:       mount(2) doc enhancements
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          closed
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Oct 19 20:45:00 +0000 2008
>Closed-Date:    Sun Oct 19 20:55:10 +0000 2008
>Last-Modified:  Sun Oct 19 21:05:02 +0000 2008
>Originator:     Robert Elz
>Release:        NetBSD 4.0_STABLE  (this is from NetBSD -current within past 10 hours)
>Organization:
	Prince of Songkla University
>Environment:
System: NetBSD jade.coe.psu.ac.th 4.0_STABLE NetBSD 4.0_STABLE (JADE-1.696-20080517) #9: Fri May 23 18:55:13 ICT 2008 kre@jade.coe.psu.ac.th:/usr/obj/4/kernels/JADE i386
Architecture: i386
Machine: i386
>Description:
	The mount(2) manpage fails to document several mount
	options.  I was looking fro MNT_RELOAD, but when I looked
	I foung that MNT_LOG and (shame on me) MNT_HIDDEN were also
	missing.   Further, the explanations given for several of the
	flags were superficial at best (not good enough to allow anyone
	to determine th euse of the flag).

>How-To-Repeat:
	RTFM.

>Fix:
	I append a patch to src/lib/libc/sys/mount.2

	[ I am send-pr'ing this in category kern rather than lib
	as mount(2) is a kernel interface, and kern-people are
	for more likely to understand the text here (and correct my
	errors) than "normal" lib people... ]

	Aside from adding the missing flags, I have reordered them to be
	in some kind of a rational order (they weren't sorted, and appeared
	to have just been thrown in and allowed to fall anywhere).

	I have also corrected a few minor wording issues and given
	the whole thing a quick cleansing..

	In particular, I changed "appeared in version 6 unix" to
	"was present in version 6 unix", as I am fairly certain that
	mount() was present way earlier than 6th edition, but I doubt anyone
	really wants to do the research to find out when mount(2)
	really was added to unix.   The "Version 6 UNIX" part should
	really be changed to "6th Edition UNIX" - back in those times
	the system was constantly evolving, there were no specific
	versions - but there were occasional printings of the manuals.
	What we call "version 6" really means "the system that corresponded
	to the 6th edition of the unix programmers manual".  That is
	not corrected here, as that appears in the macros not in mount(2)
	and so should be fixed there, not here.   Many other man pages
	should have the "s/appeared in/was present in/" change made
	however.

	I make no claim that the text here is all 100% correct,
	though I don't know any of it is incorrect - but I suspect
	that it is far more likely for someone who really knows to
	fix erroneous text, than to add what is missing.

--- mount.2	2007-12-01 15:57:23.000000000 +0700
+++ mount.2-UPDATED	2008-10-20 03:22:35.000000000 +0700
@@ -80,45 +80,86 @@
 .Bl -tag -width MNT_SYNCHRONOUS
 .It Dv MNT_RDONLY
 The file system should be treated as read-only;
 even the super-user may not write on it.
+.It Dv MNT_UNION
+Union with underlying filesystem instead of obscuring it.
+.It Dv MNT_HIDDEN
+Cause the
+.Xr df 1
+program, and perhaps others, to, by default,
+exclude this filesystem from its output.
 .It Dv MNT_NOEXEC
 Do not allow files to be executed from the file system.
 .It Dv MNT_NOSUID
 Do not honor setuid or setgid bits on files when executing them.
 .It Dv MNT_NODEV
 Do not interpret special files on the file system.
-.It Dv MNT_UNION
-Union with underlying filesystem instead of obscuring it.
-.It Dv MNT_SYNCHRONOUS
-All I/O to the file system should be done synchronously.
-.It Dv MNT_ASYNC
-All I/O to the file system should be done asynchronously.
 .It Dv MNT_NOCOREDUMP
 Do not allow programs to dump core files on the file system.
 .It Dv MNT_NOATIME
 Never update access time in the file system.
-.It Dv MNT_SYMPERM
-Recognize the permission of symbolic link when reading or traversing.
 .It Dv MNT_NODEVMTIME
 Never update modification time of device files.
+.It Dv MNT_SYMPERM
+Recognize the permission of symbolic link when reading or traversing.
+.It Dv MNT_SYNCHRONOUS
+All I/O to the file system should be done synchronously.
+This will slow I/O performance considerably, but
+enhances overall filesystem reliability.
+.It Dv MNT_ASYNC
+All I/O to the file system should be done asynchronously.
+This vastly improves I/O throughput,
+but at a cost of making the filesystem likely to be
+completely unrecoverable should the system crash while
+unwritten data is pending in kernel buffers.
 .It Dv MNT_SOFTDEP
 Use soft dependencies.
+This enhanced system performance in many cases compared
+to a default mount,
+\fIi.e.\fP one neither
+.Dv MNT_ASYNC
+nor
+.Dv MNT_SYNCHRONOUS ,
+by carefully sequencing meta-data writes to achieve the
+effect achieved by a default mount causing many meta-data
+writes to be synchronous.
+.It Dv MNT_LOG
+Use a filesystem journal.
+This is incompatible with, and overrides,
+.Dv MNT_SOFTDEP .
+.Dv MNT_LOG
+causes a journal (or log) to be created in the
+filesystem, creating a record of meta-data writes to be
+performed, allowing the actual writes to be deferred.
+This improves performance in most cases.
 .El
 .Pp
 The
-.Dv MNT_UPDATE
-and the
+.Dv MNT_UPDATE ,
+.Dv MNT_RELOAD
+and
 .Dv MNT_GETARGS
 flags indicate that the mount command is being applied
 to an already mounted file system.
 The
 .Dv MNT_UPDATE
 flag allows the mount flags to be changed without requiring
 that the file system be unmounted and remounted.
+A conversion from read-write to read-only will fail if any files
+are currently open for writing on the filesystem, unless the
+.Dv MNT_FORCE
+flag is also applied.
 Some file systems may not allow all flags to be changed.
 For example,
-most file systems will not allow a change from read-write to read-only.
+some file systems will not allow a change from read-write to read-only.
+The
+.Dv MNT_RELOAD
+flag causes kernel filesystem data to be reloaded from
+the filesystem device.
+It is only permitted on filesystems mounted read-only.
+Its purpose is to notify the system that the filesystem
+data has been modified by some external process.
 The
 .Dv MNT_GETARGS
 flag does not alter any of the mounted filesystem's properties,
 but returns the filesystem-specific arguments for the currently mounted
@@ -127,9 +168,15 @@
 The
 .Fa type
 argument defines the type of the file system.
 The types of file systems known to the system are defined in
-.Aq Pa sys/mount.h .
+.Aq Pa sys/mount.h ,
+and those supported by the current running kernel obtained
+using
+.Xr sysctl 8
+to obtain the node
+.\" .Bd -literal -offset indent
+vfs.generic.fstypes.
 .\" XXX from lite-2:
 .\" The types of filesystems known to the system can be obtained with
 .\" .Xr sysctl 8
 .\" by using the command:
@@ -230,9 +277,11 @@
 .Fn mount
 will fail when one of the following occurs:
 .Bl -tag -width Er
 .It Bq Er EPERM
-The caller is not the super-user.
+The caller is not the super-user,
+and ordinary user mounts are not permitted or
+this particular request violates the rules.
 .It Bq Er ENAMETOOLONG
 A component of a pathname exceeded
 .Dv {NAME_MAX}
 characters, or an entire path name exceeded
@@ -252,9 +301,11 @@
 .Ar special
 is not a directory.
 .It Bq Er EBUSY
 Another process currently holds a reference to
-.Fa dir .
+.Fa dir ,
+or for an update from read-write to read-only
+there are files on the filesystem open for writes.
 .It Bq Er EFAULT
 .Fa dir
 points outside the process's allocated address space.
 .El
@@ -359,8 +410,9 @@
 .Em mfs
 mount can also fail if the maximum number of file systems are currently
 mounted.
 .Sh SEE ALSO
+.Xd df 1 ,
 .Xr getvfsstat 2 ,
 .Xr nfssvc 2 ,
 .Xr getmntinfo 3 ,
 .Xr symlink 7 ,
@@ -373,14 +425,14 @@
 and
 .Fn umount
 (now
 .Fn unmount )
-function calls appeared in
+function calls were all present in
 .At v6 .
 .Pp
 Prior to NetBSD 4.0 the
 .Nm
-call was used to NFS export filesystems.
+call was used to export NFS filesystems.
 This is now done through
 .Fn nfssvc .
 .Pp
 The

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->closed
State-Changed-By: christos@NetBSD.org
State-Changed-When: Sun, 19 Oct 2008 16:55:10 -0400
State-Changed-Why:
fixed, thanks!


From: Christos Zoulas <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/39770 CVS commit: src/lib/libc/sys
Date: Sun, 19 Oct 2008 20:54:22 +0000 (UTC)

 Module Name:	src
 Committed By:	christos
 Date:		Sun Oct 19 20:54:22 UTC 2008

 Modified Files:
 	src/lib/libc/sys: mount.2

 Log Message:
 PR/39770: Robert Elz: mount(2) doc enhancements


 To generate a diff of this commit:
 cvs rdiff -r1.38 -r1.39 src/lib/libc/sys/mount.2

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.