Date: Sat, 27 Feb 2021 14:00:24 +0100 From: Arrigo Marchiori <ardovm@yahoo.it> To: freebsd-stable@freebsd.org Subject: Re: Trying do mount a slice containing a mounted partition makes the filesystem unreadable Message-ID: <YDpCaI/sNgHcf08n@nuvolo> In-Reply-To: <202102270821.11R8LerL005602@nuc.oldach.net> References: <YDmos6Mz9JhueSFh@neutralgood.org> <202102270821.11R8LerL005602@nuc.oldach.net>
next in thread | previous in thread | raw e-mail | index | archive | help
Hello Helge, Kevin, and thank you for replying. On Sat, Feb 27, 2021 at 09:21:39AM +0100, Helge Oldach wrote: > Kevin P. Neal wrote on Sat, 27 Feb 2021 03:04:35 +0100 (CET): > > On Fri, Feb 26, 2021 at 06:25:05PM +0100, Helge Oldach wrote: > > > Arrigo Marchiori via freebsd-stable wrote on Fri, 26 Feb 2021 17:02:35 +0100 (CET): > > > > Description: when a BSD partition is mounted 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. > > > > > > Actually you are mounting the same location on disk twice under > > > different file systems which is a bad idea. > > > > > > For example: > > > > > > # gpart show -p ada0s2 > > > => 0 250064341 ada0s2 BSD (119G) > > > 0 241172480 ada0s2a freebsd-ufs (115G) > > > 241172480 8891861 ada0s2b freebsd-swap (4.2G) > > > > > > Note the "0" offset for both ada0s2 and ada0s2a. When you mount, both > > > "look" like a proper, distinct UFS but actually it's the same location > > > on disk so UFS will get confused if you have both mounted rw. It should > > > go well however if only one is mounted rw and the other(s) ro. I believe that the memstick images may not organized as you pointed out. The standard behavior of mkimg(1) is to leave a small gap between the beginning of the slice and the beginning of the first partition. But I will be able to confirm on Monday, when I will be back to the office. > > Wait, really? It seems like the ro mount wouldn't see any blocks (or other > > unit of data) cached by the rw mount. So the ro mount would see an > > inconsistent filesystem and I personally would expect a crash or other > > misbehavior. > > Of course the ro "view" will show inconistencies. That's actually what > one asks for if doing such bad things as mounting volumes twice. However > it shouldn't crash as the rw mount of / maintains consistency. 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). I did not try the mount command in read-only mode. I can try this on Monday as well. IMHO it is important to note that everything works as expected when the partition is mounted from /dev/ufs/label: the mount attempt is not permitted and nothing else happens. Even if mounting an already-mounted partition is an invalid action, I do not think that it should render a system unstable. I understand that ``the root user should be allowed to do anything'', even shoot themselves in the foot. But on the other hand, there are features such as kern.geom.debugflags that explicitly avoid it. I hope I could explain myself clearly. Best regards, -- Arrigo http://rigo.altervista.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?YDpCaI/sNgHcf08n>