From nobody@FreeBSD.org Wed Sep 22 11:54:40 2010 Return-Path: Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CD64A1065693 for ; Wed, 22 Sep 2010 11:54:40 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id B0B128FC20 for ; Wed, 22 Sep 2010 11:54:40 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o8MBsdqY079827 for ; Wed, 22 Sep 2010 11:54:39 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id o8MBsdAv079820; Wed, 22 Sep 2010 11:54:39 GMT (envelope-from nobody) Message-Id: <201009221154.o8MBsdAv079820@www.freebsd.org> Date: Wed, 22 Sep 2010 11:54:39 GMT From: Konstantin Kukushkin To: freebsd-gnats-submit@FreeBSD.org Subject: GEOM_LABEL is not compatible with newfs -r flag X-Send-Pr-Version: www-3.1 X-GNATS-Notify: >Number: 150858 >Category: kern >Synopsis: [geom] [geom_label] [patch] glabel(8) is not compatible with newfs -r flag >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-geom >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Sep 22 12:00:12 UTC 2010 >Closed-Date: >Last-Modified: Wed Oct 6 12:20:00 UTC 2010 >Originator: Konstantin Kukushkin >Release: 8.1-STABLE >Organization: Rambler >Environment: FreeBSD dash.local 8.1-STABLE FreeBSD 8.1-STABLE #0: Wed Sep 22 13:18:16 MSD 2010 root@dash.local:/var/tmp/obj/usr/src/sys/EEE8 i386 >Description: For any provider, GEOM_LABEL strictly checks that ufs occupied all its space. But filesystem can be smaller, in case if newfs(8) was run with -r flag. So, GEOM_LABEL is not compatible with newfs -r flag. When check is more permissive (as in attached patch) all work OK: [pts/0] root@dash:/usr/home/dark# uname -rp 8.1-STABLE i386 [pts/0] root@dash:/usr/home/dark# ll /dev/ufsid/ total 0 crw-r----- 1 root operator 0, 93 22 ΣΕΞ 17:24 4992d90831a79611 [pts/0] root@dash:/usr/home/dark# mdconfig -s 32m md0 [pts/0] root@dash:/usr/home/dark# newfs -r 4 -U /dev/md0 /dev/md0: 32.0MB (65532 sectors) block size 16384, fragment size 2048 using 4 cylinder groups of 8.00MB, 512 blks, 1024 inodes. with soft updates super-block backups (for fsck -b #) at: 160, 16544, 32928, 49312 [pts/0] root@dash:/usr/home/dark# ll /dev/ufsid/ total 0 crw-r----- 1 root operator 0, 93 22 ΣΕΞ 17:24 4992d90831a79611 crw-r----- 1 root operator 0, 118 22 ΣΕΞ 13:38 4c99ce860db39b88 [pts/0] root@dash:/usr/home/dark# glabel status Name Status Components ntfs/sys N/A ada0s1 msdosfs/SYS N/A ada0s2 msdosfs/BIOS N/A ada0s3 ntfs/BIG N/A ada1s2 ufsid/4992d90831a79611 N/A ada1s1a ufsid/4c99ce860db39b88 N/A md0 >How-To-Repeat: radius# uname -rp 8.1-20100726-SNAP i386 radius# ll /dev/ufsid/ total 0 crw-r----- 1 root operator 0, 98 21 ΣΕΞ 22:01 4c98f1c148b0469b crw-r----- 1 root operator 0, 99 21 ΣΕΞ 22:01 4c98f1c978a6bb52 radius# mdconfig -s 32m md0 radius# newfs -r 4 -U /dev/md0 /dev/md0: 32.0MB (65532 sectors) block size 16384, fragment size 2048 using 4 cylinder groups of 8.00MB, 512 blks, 1024 inodes. with soft updates super-block backups (for fsck -b #) at: 160, 16544, 32928, 49312 radius# ll /dev/ufsid/ total 0 crw-r----- 1 root operator 0, 98 21 ΣΕΞ 22:01 4c98f1c148b0469b crw-r----- 1 root operator 0, 99 21 ΣΕΞ 22:01 4c98f1c978a6bb52 radius# glabel status Name Status Components ufsid/4c98f1c148b0469b N/A ada2d ufsid/4c98f1c978a6bb52 N/A ada3d >Fix: Use attached patch. Patch attached with submission follows: --- /sys/geom/label/g_label_ufs.c.orig 2010-07-11 23:06:52.000000000 +0400 +++ /sys/geom/label/g_label_ufs.c 2010-09-22 12:21:23.000000000 +0400 @@ -83,10 +83,10 @@ continue; /* Check for magic and make sure things are the right size */ if (fs->fs_magic == FS_UFS1_MAGIC && fs->fs_fsize > 0 && - pp->mediasize / fs->fs_fsize == fs->fs_old_size) { + pp->mediasize / fs->fs_fsize >= fs->fs_old_size) { /* Valid UFS1. */ } else if (fs->fs_magic == FS_UFS2_MAGIC && fs->fs_fsize > 0 && - pp->mediasize / fs->fs_fsize == fs->fs_size) { + pp->mediasize / fs->fs_fsize >= fs->fs_size) { /* Valid UFS2. */ } else { g_free(fs); >Release-Note: >Audit-Trail: Responsible-Changed-From-To: freebsd-bugs->freebsd-geom Responsible-Changed-By: arundel Responsible-Changed-When: Wed Sep 22 12:14:52 UTC 2010 Responsible-Changed-Why: Over to maintainer(s). http://www.freebsd.org/cgi/query-pr.cgi?pr=150858 From: Pawel Jakub Dawidek To: Gleb Smirnoff Cc: Konstantin Kukushkin Subject: Re: kern/150858 Date: Tue, 5 Oct 2010 16:46:01 +0200 --Zfao1/4IORAeFOVj Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Oct 05, 2010 at 02:39:54PM +0400, Gleb Smirnoff wrote: > Hello, Pawel! >=20 > There is a PR from my colleague - kern/150858. Do you > see any side effects of such loosening the comparison? > Can this be committed? (CCing Konstantin) Yes, what we have now is lesser evil. If we drop size comparison then GEOM_LABEL can pick anything from ad0, ad0s1 and ad0s1a when you have file system on top of ad0s1a and all start at offset 0. Unfortunately UFS metadata is not designed for automatic discovery, so there is not much we can do here. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --Zfao1/4IORAeFOVj Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkyrOikACgkQForvXbEpPzRHqgCgruQUAFnnPR1+io04k9i4HMKW NXgAoL31SIHb8VpiuQjRwYEHHc3RPaou =EyEt -----END PGP SIGNATURE----- --Zfao1/4IORAeFOVj-- >Unformatted: