From owner-freebsd-stable@FreeBSD.ORG Sun Jul 4 21:15:35 2010 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 007FE1065672 for ; Sun, 4 Jul 2010 21:15:35 +0000 (UTC) (envelope-from yanefbsd@gmail.com) Received: from mail-qy0-f182.google.com (mail-qy0-f182.google.com [209.85.216.182]) by mx1.freebsd.org (Postfix) with ESMTP id AB5AB8FC1D for ; Sun, 4 Jul 2010 21:15:34 +0000 (UTC) Received: by qyk7 with SMTP id 7so1631865qyk.13 for ; Sun, 04 Jul 2010 14:15:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=wPk35IhUz8fIe4AOooPqQhSa8SzS7rpkp8XtZhF/KJg=; b=nZ0+xCGei4HFopJ4mGWn9tFYht903KIBO0FPjRn7W4v8twHVxnWGTkRLMRTHOSVuyF GQ2BPy812JOYJh/1KKwjVs/0mvfwRIvemdhmeJoprEafmHor7qmCPnEMV2zHt/dHzOUI 3SS2+ITwStu7hIyCzW8oNYdc7gU/nf1rw4eD0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=uhWj7Sr3eESDVex925dXcwQ8BI3CIJoZPvVlDeOH4bUC/ygeRffKQMrWG/b3p6z4bG x6zwDtvHYCH3UAw8IlDwvKSDMQXHHGK0QAicROpOvNuQ5ovhIat2c7PpMICcbyeLmIMQ Y5r/3EtO2/14+Z0PK5g5ml4WH7q1DWzLxDl54= MIME-Version: 1.0 Received: by 10.229.246.15 with SMTP id lw15mr952339qcb.284.1278278130744; Sun, 04 Jul 2010 14:15:30 -0700 (PDT) Received: by 10.229.192.201 with HTTP; Sun, 4 Jul 2010 14:15:30 -0700 (PDT) In-Reply-To: <4C30AAA8.7010206@andric.com> References: <4C309359.8000502@andric.com> <791316F7-6E16-47D7-9B6C-2881FAAC78AA@gsoft.com.au> <4C30AAA8.7010206@andric.com> Date: Sun, 4 Jul 2010 14:15:30 -0700 Message-ID: From: Garrett Cooper To: Dimitry Andric Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: FreeBSD Stable Subject: Re: GEOM/bsdlabel regression in 8.x? X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Jul 2010 21:15:35 -0000 On Sun, Jul 4, 2010 at 8:37 AM, Dimitry Andric wrote: > On 2010-07-04 16:26, Daniel O'Connor wrote: >>> First unmount /dev/md0s1a, or the device /dev/md0s1 will be in use, and >>> opening it for read/write (as bsdlabel probably does) will fail. >>> >>> Alternatively, you can turn on the "footshooting" debug flag in geom: > ... >> It doesn't make a difference if you set that flag or not. >> >> (The fact you need to set debugflags to modify the MBR is a separate bug= anyway IMO) > > On my 8-stable box, I have tried this sequence of commands: > > =A0truncate -s 10m /tmp/test > =A0mdconfig -a -t vnode -f /tmp/test > =A0mdconfig -a -t vnode -f /tmp/test > =A0fdisk -BI /dev/md0 > =A0bsdlabel -w /dev/md0s1 > =A0bsdlabel -e /dev/md0s1 > =A0newfs /dev/md0s1a > =A0mkdir /mnt/test > =A0mount /dev/md0s1a /mnt/test > =A0bsdlabel -e /dev/md0s1 > > The last one indeed fails, because the device is in use. =A0This is > expected, but the error message is very misleading, and should be > improved. > > The real 'bug' (although there will probably be loads of bikesheds about > it) is probably that if you *do* unmount the filesystem, bsdlabel still > fails: > > =A0umount /mnt/test > =A0bsdlabel -e /dev/md0s1 > =A0[class not found yada yada] > > Apparently, unmounting does not properly 'release' whatever underlying > geom device is preventing read/write access. =A0However, if you then set > the footshooting flag: > > =A0sysctl -w kern.geom.debugflags=3D0x10 > =A0bsdlabel -e /dev/md0s1 > > bsdlabel can write without problems, at least on my box. =A0Stranger > even, if you subsequently turn off the footshooting flag, it *still* > can write to the label. =A0That is, unless you mount and unmount the > filesystem, after which is again, sort of 'locked' against writing. > > All highly confusing. :) There's a weird ass feature in geom too under 7.x+ that if you have where if you have a dangerously dedicated disk partitioned like so that gets mounted, it automatically hides the slicing: $ dd if=3D/dev/zero of=3Dafile bs=3D10m count=3D5 $ mdconfig -a -t vnode -f afile md1 $ ls /dev/md1* /dev/md1 $ sudo fdisk -BIq /dev/md1 $ bsdlabel -w /dev/md1s1 $ bsdlabel -e /dev/md1s1 # /dev/md1s1: 8 partitions: # size offset fstype [fsize bsize bps/cpg] a: 96311 16 unused 0 0 c: 96327 0 unused 0 0 # "raw" part, don't= edit # newfs /dev/md1s1 /dev/md1s1: 47.0MB (96324 sectors) block size 16384, fragment size 2048 using 4 cylinder groups of 11.77MB, 753 blks, 1536 inodes. super-block backups (for fsck -b #) at: 160, 24256, 48352, 72448 $ ls /dev/md1* /dev/md1 /dev/md1s1 $ ls /dev/md1* /dev/md1 /dev/md1s1 /dev/md1s1a $ mount /dev/md1s1 /mnt/mem $ ls /dev/md1* /dev/md1 /dev/md1s1 $ umount /mnt/mem $ ls /dev/md1* /dev/md1 /dev/md1s1 /dev/md1s1a It's something that someone noticed at my work. Thanks, -Garrett