Index | Thread | Search

From:
Helg <helg-openbsd@gmx.de>
Subject:
Re: mount(2) fixes
To:
Crystal Kolipe <kolipe.c@exoticsilicon.com>
Cc:
tech@openbsd.org
Date:
Thu, 20 Nov 2025 08:12:19 +0100

Download raw body.

Thread
On Wed, Nov 19, 2025 at 05:47:00PM +0000, Crystal Kolipe wrote:
> Fix a couple of bugs in mount(2):
> 
> 
> 1. The manual page contains the following text:
> 
> "For example, most filesystems will not allow a change from read-write to
>  read-only."
> 
> As far as I can tell, this text was added in 4.3BSD-Reno and propogated to
> OpenBSD via the initial import of the NetBSD tree.
> 
> In fact, all of ffs, mfs, tmpfs, ext2fs, and msdosfs allow re-mounting as
> read-only.
> 
> (At least they do via the mount syscall, separately /sbin/mount fails when
>  given an mfs filesystem as an argument along with -u because it doesn't
>  understand the 'mfs:*' device string, but that's a separate issue.)
> 
> ISO9660, UDF, and ntfs are read-only implementations anyway, so there is no
> concept of re-mounting from read-write to read-only.
> 
> So the idea that _most_ filesystems don't allow a change from read-write to
> read-only is now clearly outdated.  Let's just remove the example.

I believe there are some problems with vnode leaking if you remount a
file system, so there might be some caveates. Others here might know
more.

I looked at implementing MNT_UPDATE support for fusefs but it turned out
to be non-trivial and I can't think of a reason why this is needed. If
you want a read-only FUSE file system, just mount it read-only.

I want to change the regress/sys/ffs tests to remount the file system
being tested but due to mfs and fusefs not supporting remounting
I've put it on hold. Currently, the tests mount a new ffs
partition read-only, regardless of the file system type being tested.

> 
> 2. The description of struct iso_args is missing the 'sess' element.
> 
> 
> The following patch fixes those two issues.
> 
> Aside from that, the manual page is also missing all of the NFSMNT_* mount
> option flags, as well as a description of fusefs_args.
> 
> I've not included fixes for those because in the case of the NFSMNT_* options
> it seems like a lot of bloat that might not really belong in the manual page,
> and since fusefs is not usable without external software that is not part of
> base, it's not obvious if the fusefs_args should be documented in the manual
> either.
> 

I agree that documenting fusefs_args here isn't necessary, but a
reference to fuse_mount(3) in the SEE ALSO section would help. This is
the recommended way to mount a FUSE file system.

> 
> --- lib/libc/sys/mount.2
> +++ lib/libc/sys/mount.2
> @@ -115,8 +115,6 @@
>  This allows the mount flags to be changed without requiring
>  that the filesystem be unmounted and remounted.
>  Some filesystems may not allow all flags to be changed.
> -For example,
> -most filesystems will not allow a change from read-write to read-only.
>  .Pp
>  The
>  .Fa type
> @@ -136,6 +134,7 @@
>      struct	export_args export_info;
>      			    /* network export info */
>      int	flags;		    /* mounting flags, see below */
> +    int sess;		    /* start sector of session */
>  };
>  #define	ISOFSMNT_NORRIP	  0x00000001 /* disable Rock Ridge Ext.*/
>  #define	ISOFSMNT_GENS	  0x00000002 /* enable generation numbers */
>