Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Mar 2021 08:50:31 +0100
From:      Arrigo Marchiori <ardovm@yahoo.it>
To:        freebsd-stable@freebsd.org
Subject:   Re: Trying do mount a slice containing a r/o mounted partition makes the filesystem unreadable
Message-ID:  <YD3uRz5wgf9lmvPH@nuvolo>
In-Reply-To: <YDpmnBNO9J4e1p4C@nuvolo>
References:  <YDpCaI/sNgHcf08n@nuvolo> <202102271443.11REhqps070102@nuc.oldach.net> <YDpmnBNO9J4e1p4C@nuvolo>

next in thread | previous in thread | raw e-mail | index | archive | help
Dear All,

On Sat, Feb 27, 2021 at 04:34:52PM +0100, Arrigo Marchiori via freebsd-stable wrote:

> Hello Helge, and thank you for replying again.
> 
> On Sat, Feb 27, 2021 at 03:43:52PM +0100, Helge Oldach wrote:
> 
> > Arrigo Marchiori via freebsd-stable wrote on Sat, 27 Feb 2021 14:00:24 +0100 (CET):
> > > On the memstick, the root filesystem is mounted read-only.  I
> > > apologize, I should have told it explicitly.  The ``invalid'' attempt
> > > is to mount it read-write (no mode is indicated on the command line).
> > 
> > Try to make it r/w mounted (which I suspect you are attempting to
> > achieve):
> > 
> > mount -uw /
> 
> Ok, I will try this.
> 
> But just for the record: I am not try to achieve anything.  I gave the
> ``invalid'' mount command by mistake (I wanted to mount a partition
> from another disk and wrote "da0" instead of "da1") and I saw that the
> system became unstable. I thought that this should not happen and I
> reported it here.

I have two updates.

 1- the da0s2a slice starts 16 (blocks?) after the beginning of da0s2.
    bsdlabel(8) output (copied by hand):
# /dev/da0s2:
8 partitions:
#       size     offset    fstype    [fsize  bsize bps/cpg]
  a: 1491200         16    4.2BSD         0      0     0
  c: 1491216          0    unused         0      0     # "raw" part, don't edit

 2- if I mount the partition rw, then the mount command _always_ fails
 with error "operation not permitted" and the system _always_ remains
 stable. This is independent from mounting from /dev/ufs/label or
 /dev/da0s2a.

Therefore I can change the description of this problem report as:

----8<--------8<--------8<--------8<--------8<--------8<--------8<---------

When a BSD partition is mounted _read_only_ to / (suppose
/dev/da0s2a), if I try to mount its containing slice (/dev/da0s2) I
receive a ``strange'' error message, and from that moment the mounted
filesystem becomes unreadable.

 - If the partition is mounted from /dev/ufs/label, then mount(8)
reports "Operation not permitted" and the system remains stable.
This is the expected behavior IMHO.

 - If the partition is mounted read_write, from any special device,
   then mount(8) reports:
     - "Operation not permitted" if I try to mount the slice rw,
     - the same strange error message if I try to mount the slice ro,
   and the system remains stable.

 - The "strange error message" is "invalid argument" on 11.4-STABLE.

----8<--------8<--------8<--------8<--------8<--------8<--------8<---------

Now to the question: is this worth a PR? Was it already reported?  Or
is it just something that ``should not happen'' because root should be
allowed to shoot themselves in the foot?

Thank you in advance and best regards,
-- 
Arrigo

http://rigo.altervista.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?YD3uRz5wgf9lmvPH>