From owner-freebsd-bugs@freebsd.org Wed Dec 25 15:13:51 2019 Return-Path: Delivered-To: freebsd-bugs@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 747D31DF1C3 for ; Wed, 25 Dec 2019 15:13:51 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.nyi.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id 47jc732YhFz41Rr for ; Wed, 25 Dec 2019 15:13:51 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.nyi.freebsd.org (Postfix) id 55E061DF1C2; Wed, 25 Dec 2019 15:13:51 +0000 (UTC) Delivered-To: bugs@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 559CA1DF1C1 for ; Wed, 25 Dec 2019 15:13:51 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47jc731bLRz41Rq for ; Wed, 25 Dec 2019 15:13:51 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 31F291A54E for ; Wed, 25 Dec 2019 15:13:51 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id xBPFDpKa067082 for ; Wed, 25 Dec 2019 15:13:51 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id xBPFDpuR067070 for bugs@FreeBSD.org; Wed, 25 Dec 2019 15:13:51 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 242883] geom: GPT inside gconcat loads incorrectly Date: Wed, 25 Dec 2019 15:13:51 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: noah.bergbauer@tum.de X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Dec 2019 15:13:51 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D242883 Bug ID: 242883 Summary: geom: GPT inside gconcat loads incorrectly Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: noah.bergbauer@tum.de Example: # truncate -s 1G test.bin # mdconfig -f test.bin md0 # gconcat label outer md0 # gpart create -s gpt concat/outer concat/outer created # gpart add -t freebsd concat/outer concat/outers1 added # gconcat label inner concat/outers1 # mdconfig -du 0 At this point test.bin contains a gconcat "inner" inside a GPT gpart inside= a gconcat "outer". However: # mdconfig -f test.bin md0 # geom -t Geom Class Provider md0 MD md0 md0 DEV md0 PART md0s1 md0s1 DEV inner CONCAT concat/inner concat/inner DEV outer CONCAT concat/outer concat/outer DEV concat/outer PART concat/outers1 concat/outers1 DEV In the words of dmesg: GEOM_CONCAT: Device outer created (id=3D1505886249). GEOM_CONCAT: Disk md0 attached to outer. GEOM_CONCAT: Device concat/outer activated. GEOM: md0: the secondary GPT header is not in the last LBA. GEOM_CONCAT: Device inner created (id=3D4175896209). GEOM_CONCAT: Disk md0s1 attached to inner. GEOM_CONCAT: Device concat/inner activated. GEOM_CONCAT: Cannot add disk concat/outers1 to inner (error=3D17). The kernel sees two perspectives of our GPT table: The correct one from ins= ide of concat/outer and the incorrect one on raw md0 where the last sector (whi= ch contains the gconcat info) is simply considered broken (hence the warning). This behavior is arguably correct - a command like `mount /dev/concat/outer= s1 /mnt` would work correctly. However we run into problems when stacking other geoms on top of the gpart, like concat/inner in this example. The kernel actually notices the (incorrectly accessed) md0s1 FIRST, creates the gconcat provider on top of that and then REJECTS the (correct) concat/outers1. This, in spite of being wrong, still works for reading. But the read lock on md0 through the wrong access paths prevents us from modifying the GPT in concat/outer. The only workaround is to manually stop all inner geoms on md0(raw) and try to somehow make it re-taste correctly. Obviously this has = to be done on every reboot and requires all filesystems inside this constructi= on to be temporarily unmounted. Not sure what the correct solution is. Either gconcat needs to somehow understand that concat/outers1 is a "better" path than md0s1 and replace the underlying access path. Or the kernel must somehow ensure that the non-corrupted path is always seen first, leaving the perspective with the corrupted gpt only as a very last resort. --=20 You are receiving this mail because: You are the assignee for the bug.=