Bug #1537

null mount does not accept -o update

In contrast to all other file systems, null mounts can not be updated,
using mount -u or -o update. That means that null mounts (of PFS
usually) which were initially mounted ro can not be upgraded to rw, but
have to be unmounted first.

hit -> hint I assume. Yes, you should be able to imlement the
MNT_UPDATE stuff for null mounts. MNT_UPDATE implementations only
allow certain flags to be changed out from under the mounted filesystem.
For null mounts basically the only thing you can update is read-only
vs read-write operation.

You can see how other VFSs handle MNT_UPDATE. It is fairly
straightforward.

1. Switching between ro/rw in a local null mount.
And verified read-onlyness by trying to touch a file.

2. Switching between ro/rw in stacks of local null mounts.
And verified read-onlyness by trying to touch a file.

3. Switching between ro/rw in a NFS exported null mount.
Specifically, /pfs/@@-1:00004 was null mounted on /home. And /home was NFS
shared with dfly being the server. NFS client was opensolaris build 126. I was
able to write from osol when /home was exported as read-write, and failed to do
so when it was exported as read-only. Client correctly reported that fs was
read-only. And so did mount(8) in the server side.

I can provide copy/pastes from sessions, upon request. But better, fetch the
patch and try it yourself :)

:Stathis Kamperis <ekamperi@gmail.com> added the comment:
:
:Ping!
:
:Anyone interested with time and clue to review the patch ?
:I'd like to push it at some point, before it gets too stale, but ain't gonn=
:a
:happen if at least someone else gives me a thumbs up.
:
:Cheers,
:Stathis

It looks committable to me. The only possible issue is whether
the type field for mount -u operations can ever be NULL. It
doesn't seem to ever be NULL so I think we're ok there.

> I noticed that I can't remount nullfs by mount(8). The patched
> mount_null accepts only one argument (the mountpoint to be remounted)
> when MNT_UPDATE is specified either by -u or by -o update, but
> what mount(8) passes to filesystem-specific mount commands like this:
> # mount -ur /mnt/pt
> -> mount_${foo} -o ro -o update /path/to/special /mnt/pt
> # mount -uw /mnt/pt
> -> mount_${foo} -o noro -o update /path/to/special /mnt/pt
>
> I think that the following patch on top of yours does this for you,
> although I only tested it slightly.

I'm in the middle of a build. Once it finishes, I'll apply your modifications on
top of my patch & re-run all the tests I've done so far, plus your test cases
that involve mount(8).

If everything works and given that Dillon didn't object, I'll push it in the
next couple of days.