From owner-dev-commits-src-main@freebsd.org Mon Jul 5 19:58:58 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 682AF662848 for ; Mon, 5 Jul 2021 19:58:58 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GJc2T1SrJz3mJ5 for ; Mon, 5 Jul 2021 19:58:57 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f52.google.com with SMTP id f14so22977820wrs.6 for ; Mon, 05 Jul 2021 12:58:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=OXc8QeWAZNBwt896YzoLowptHdApb19pMW2mxtEV8mg=; b=K3VRCjnyxnvzJdbcLkTEHNB4cu1WeMywZCTeQhpMvagKjDObiNOjR2D1YWjrPW6NFQ +K9prO1Xnwk/nI98VC0+dqwV4a1L7Xks/nbmFcRElqMXyCoiFhjucpGY8tF+hhQsTayP lAngmPq1Cxa1VG6DyH3qhPKYSdor3/cVzqLls5teUORZtPiPK5Is1zEdQloSTRIFiSvx +owVT1YC6tEbUeWTYpkCr68U2W3DELIAO02hwR9to2qy1jmEwBgzxFUWlhOf97gjV6M5 5cVwVxMBnoj16mpFQZygxRybvn+16WkiRLsx7jwKtinELv75eQRByIjr9cMTYIKeLUkW 98pw== X-Gm-Message-State: AOAM532fkzvAhXSpD4GPcR/CjAdApxB28fVN8LGbi8wpeDKO0ecKwhFl 4US8wpDBWFPac0mDFfOEU/fTNQ== X-Google-Smtp-Source: ABdhPJwBA5dl97ixRn90rtzZY99flgTDm5a8H8BqwYZGHMao6n3GjVr2Y0Sa2+UGxuqV3DeGS0PAaw== X-Received: by 2002:adf:de92:: with SMTP id w18mr6830300wrl.42.1625515135755; Mon, 05 Jul 2021 12:58:55 -0700 (PDT) Received: from smtpclient.apple (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id f1sm4736826wri.74.2021.07.05.12.58.55 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Jul 2021 12:58:55 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.100.0.2.22\)) Subject: Re: git: af433832f752 - main - geom_label: Remove an old sysinstall(8) workaround From: Jessica Clarke In-Reply-To: <202107051856.165IukLl003702@slippy.cwsent.com> Date: Mon, 5 Jul 2021 20:58:53 +0100 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <11BB2019-EAE3-40A6-A3B1-EA3241AA91BF@freebsd.org> References: <202107051517.165FHsfD012512@gitrepo.freebsd.org> <202107051836.165IaspD003460@slippy.cwsent.com> <202107051856.165IukLl003702@slippy.cwsent.com> To: Cy Schubert X-Mailer: Apple Mail (2.3654.100.0.2.22) X-Rspamd-Queue-Id: 4GJc2T1SrJz3mJ5 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of jrtc27@jrtc27.com designates 209.85.221.52 as permitted sender) smtp.mailfrom=jrtc27@jrtc27.com X-Spamd-Result: default: False [-2.46 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; MV_CASE(0.50)[]; RCVD_COUNT_THREE(0.00)[3]; NEURAL_HAM_SHORT(-0.96)[-0.960]; FORGED_SENDER(0.30)[jrtc27@freebsd.org,jrtc27@jrtc27.com]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; MID_RHS_MATCH_FROM(0.00)[]; FROM_NEQ_ENVFROM(0.00)[jrtc27@freebsd.org,jrtc27@jrtc27.com]; ARC_NA(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[209.85.221.52:from]; FREEFALL_USER(0.00)[jrtc27]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-main@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; SPAMHAUS_ZRD(0.00)[209.85.221.52:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[209.85.221.52:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.221.52:from]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-main] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 19:58:58 -0000 On 5 Jul 2021, at 19:56, Cy Schubert wrote: >=20 > In message , Jessica=20= > Clarke w > rites: >> On 5 Jul 2021, at 19:36, Cy Schubert = wrote: >>>=20 >>> In message <202107051517.165FHsfD012512@gitrepo.freebsd.org>, = Jessica=20 >>> Clarke wr >>> ites: >>>> The branch main has been updated by jrtc27: >>>>=20 >>>> URL: = https://cgit.FreeBSD.org/src/commit/?id=3Daf433832f7520840c22edd1fe1266 >> c1a >>>> 5cb781ad >>>>=20 >>>> commit af433832f7520840c22edd1fe1266c1a5cb781ad >>>> Author: Jessica Clarke >>>> AuthorDate: 2021-07-05 15:15:32 +0000 >>>> Commit: Jessica Clarke >>>> CommitDate: 2021-07-05 15:15:32 +0000 >>>>=20 >>>> geom_label: Remove an old sysinstall(8) workaround >>>>=20 >>>> We removed sysinstall(8) back in 2011, so this workaround should = be lon >> g >>>> since unnecessary. This workaround can end up breaking cases that = are >>>> hit in the real world, such as dd'ing a small pre-built disk = image to a >>>> large partition that you intend to grow on first boot and uses a = UFS >>>> disk label for / in its /etc/fstab (as the only reliable thing a = raw UF >> S >>>> image can reference). >>>>=20 >>>> Reviewed by: imp, mckusick >>>> Differential Revision: https://reviews.freebsd.org/D30825 >>>> --- >>>> sys/geom/label/g_label_ufs.c | 35 = +++++------------------------------ >>>> 1 file changed, 5 insertions(+), 30 deletions(-) >>>>=20 >>>> diff --git a/sys/geom/label/g_label_ufs.c = b/sys/geom/label/g_label_ufs.c >>>> index ababbaa4b43a..70d59488d7b6 100644 >>>> --- a/sys/geom/label/g_label_ufs.c >>>> +++ b/sys/geom/label/g_label_ufs.c >>>> @@ -49,19 +49,8 @@ __FBSDID("$FreeBSD$"); >>>> #define G_LABEL_UFS_ID 1 >>>>=20 >>>> /* >>>> - * G_LABEL_UFS_CMP returns true if difference between provider = mediasize >>>> - * and filesystem size is less than G_LABEL_UFS_MAXDIFF sectors >>>> - */ >>>> -#define G_LABEL_UFS_CMP(prov, fsys, size) =09 >>>> \ >>>> - ( abs( ((fsys)->size) - ( (prov)->mediasize / (fsys)->fs_fsize = )) \ >>>> - < G_LABEL_UFS_MAXDIFF ) >>>> -#define G_LABEL_UFS_MAXDIFF 0x100 >>>> - >>>> -/* >>>> - * Try to find a superblock on the provider. If successful, then >>>> - * check that the size in the superblock corresponds to the size >>>> - * of the underlying provider. Finally, look for a volume label >>>> - * and create an appropriate provider based on that. >>>> + * Try to find a superblock on the provider. If successful, look = for a vo >> lum >>>> e >>>> + * label and create an appropriate provider based on that. >>>> */ >>>> static void >>>> g_label_ufs_taste_common(struct g_consumer *cp, char *label, size_t = size,=20 >> in >>>> t what) >>>> @@ -81,24 +70,10 @@ g_label_ufs_taste_common(struct g_consumer *cp, = char * >> lab >>>> el, size_t size, int wh >>>> return; >>>> } >>>>=20 >>>> - /* >>>> - * Check for magic. We also need to check if file system size >>>> - * is almost equal to providers size, because sysinstall(8) >>>> - * used to bogusly put first partition at offset 0 >>>> - * instead of 16, and glabel/ufs would find file system on slice >>>> - * instead of partition. >>>> - * >>>> - * In addition, media size can be a bit bigger than file system >>>> - * size. For instance, mkuzip can append bytes to align data >>>> - * to large sector size (it improves compression rates). >>>> - */ >>>> - if (fs->fs_magic =3D=3D FS_UFS1_MAGIC && fs->fs_fsize > 0 && >>>> - ( G_LABEL_UFS_CMP(pp, fs, fs_old_size) >>>> - || G_LABEL_UFS_CMP(pp, fs, fs_providersize))) { >>>> + /* Check for magic. */ >>>> + if (fs->fs_magic =3D=3D FS_UFS1_MAGIC && fs->fs_fsize > 0) { >>>> /* Valid UFS1. */ >>>> - } else if (fs->fs_magic =3D=3D FS_UFS2_MAGIC && fs->fs_fsize > 0 = && >>>> - ( G_LABEL_UFS_CMP(pp, fs, fs_size) >>>> - || G_LABEL_UFS_CMP(pp, fs, fs_providersize))) { >>>> + } else if (fs->fs_magic =3D=3D FS_UFS2_MAGIC && fs->fs_fsize > = 0) { >>>> /* Valid UFS2. */ >>>> } else { >>>> goto out; >>>>=20 >>>=20 >>> On one of my machines which uses UFS filesystems (sandbox) also = fails: >>>=20 >>> bob# ls /dev/ufs >>> s10-amd64 s13-amd64 s13-amd64e test >>> s11-amd64 s13-amd64a s13-amd64f testa >>> s12-amd64 s13-amd64d s13-i386 >>> bob# mount /alt/s11-amd64/root >>> bob# ls /dev/ufs >>> s10-amd64 s12-amd64 test >>> s11-amd64 s13-i386 testa >>> bob#=20 >>>=20 >>> After the mount of /alt/s11-amd64/root, s10-amd64 the s13-* = filesystems=20 >>> become unavailble They share the same fdisk slice, using different=20= >>> bsdlabel partitions within the slice. >>>=20 >>> My laptop zfs pool is on a partition in the same slice as its UFS=20 >>> filesystems. Looks like once a filesystem on a slice has been = mounted, the=20 >>> other partitions within the slice are no longer available following = this=20 >>> commit. >>=20 >> Hm, what does bsdlabel on the disk say? My guess is your disk is set = up >> in the bogus manner mentioned in that comment. Is it an old machine >> installed by sysinstall(8)? >=20 > A little more investigation shows that on the two affected machines, = UFS=20 > partitions are at offset 0 of their respective slices. For legacy=20 > environments this will require some kind of workaround or boot off a = rescue=20 > disk (which I do have) to dump/recreate/restore the partitions at an = offset=20 > that is not zero. The problem is quite logical. >=20 > Doing the work to recreate the partitions doesn't bother me but other=20= > people may trip across this. Your call. How about something like D31068? Jess