From nobody Mon Feb 21 11:39:51 2022 X-Original-To: stable@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A095419D4142; Mon, 21 Feb 2022 11:39:53 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4K2L214Dd0z4sxP; Mon, 21 Feb 2022 11:39:53 +0000 (UTC) (envelope-from avg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645443593; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=emT4zi6SjSR/IduGa1BCQC1A/iNx5efxMHBwXElIMUc=; b=k8RbIBW70pjD6WMpT5K/pCMagIhEzL6ynhr8tR4oNcR3lXPVC/GgQGNHpqtlhJsXkxiVep bCf7O2ELW2nBkhfDZafrJtp+H2jNXc2dosZ1+wfr0gAtUjsNJUJRexZ6ZqmSZamXs9mFum HXH1vg96r1k2ElCCQG0qmMIAOF0ytcCap+5jePlbNffIRpudFo+Ri8qwedlHnapQ2q8Z3D CLysi2syT18pPlsxd6dV9NClwF7XDBPHRD2A0phUg7d4LtGAUfacTuWTAduaGrOtRtDxQh 0/XtLDx4q3Ym5Jh2pEMSPSeGD+ji+jS5KHPQhKoIWj6NhhfE5DXDHKz7rIoVEg== Received: from [192.168.0.88] (unknown [195.64.148.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: avg/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id EAAAA3EB6; Mon, 21 Feb 2022 11:39:52 +0000 (UTC) (envelope-from avg@FreeBSD.org) Message-ID: Date: Mon, 21 Feb 2022 13:39:51 +0200 List-Id: Production branch of FreeBSD source code List-Archive: https://lists.freebsd.org/archives/freebsd-stable List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-stable@freebsd.org X-BeenThere: freebsd-stable@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:91.0) Gecko/20100101 Firefox/91.0 Thunderbird/91.6.0 From: Andriy Gapon Subject: Re: fsck -C -p: NO WRITE ACCESS Content-Language: en-US To: freebsd-stable List , freebsd-fs , "freebsd-geom@FreeBSD.org" References: <346d021f-b737-f41a-883f-e821389c4431@FreeBSD.org> <20220214231758.GD97875@funkthat.com> <5eac56d0-51fb-5e23-0d2a-3c6b6bf163d0@FreeBSD.org> <20220218020821.GK97875@funkthat.com> In-Reply-To: <20220218020821.GK97875@funkthat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645443593; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=emT4zi6SjSR/IduGa1BCQC1A/iNx5efxMHBwXElIMUc=; b=kOG2ORqNtnqtkNgOuNtzibs9cmEegqvAE69FkDaYil7hPCFTBs5mux1jdOUVROVGEL642h 9ZUtAdx5Dcmkpj+WV/ioe9EGoPFOsX3plaWmb+yg7WAbvywLblVSwfo56jJjh4J+oLp62U 0Y5Y9FQBCnapvSWG5xWMQ4Sj945332EZ+DkILCivg9oQBKHYMG6p5Yn3l4LQ1DH4xJ6R3y 1QAPCIYsCASwh1b9wJFCgR8c9sGNfeu/GfQI7n8eD4NoLiosINLavnM3RUCuA/th+o4F9o PXFJlfktp2Ayt9qylWnMWcpxvpDMKH2oPUy9zN9kpJ5K5CjUdrwkwLk6JrP5jg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1645443593; a=rsa-sha256; cv=none; b=deTqSqk8ed2ghK9E6B3RWiE91KB4W6lUvqLksfnQVWvJnWS/qJEmNJcvkH7ApEROJQRdTI RCy2kBHMQwUnbzFzrlJo7MVZBnVWBuHkszKXY8uhQgG0ZSbfL7L/Q9PfgqIP6Olt3tqBrQ Uq1ER+SUmVgHu+APWgEIxI6TI6J8XWwfW9G+ds8waBXpsYoGzDOFJK23vmDQKT7qQRhvh+ eOoFrJvqfrQ597GjpHc+S0SJ7U3S3ldQEerGlUDPcih+pg+LrQ5y2Tt6P7yH3xlTsDBmph d+qp88d98T8GohLMTsWL3Ln8TlJNdJC/eiUrTbhBUXrZKtV8gHlITLpfe+/UHQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N On 18/02/2022 04:08, John-Mark Gurney wrote: > Andriy Gapon wrote this message on Tue, Feb 15, 2022 at 08:44 +0200: >> On 15/02/2022 01:17, John-Mark Gurney wrote: >>> Andriy Gapon wrote this message on Mon, Feb 07, 2022 at 14:15 +0200: >>>> I've got a problem where fsck behaves differently from my expectations. >>>> The problem happens with a filesystem on a GELI encrypted ZVOL. >>>> The volume has 4K block size and that's the GELI's sector size as well. >>>> FreeBSD is stable/13 from mid January. >>> >>> Did you put a ffs filesystem that was formatted on a 512 byte sector disk >>> onto this geli device? >> >> As far as I can recall, no. I created it with newsfs on the geli device. > > Looks like it's a bug in newfs, as I just reproduced this myself: > fsbtodb int32_t 0x00000003 > > and manually specifying a sector size of 4096 to newfs does not fix the > issue. > > This is the issue: > https://cgit.freebsd.org/src/blame/sbin/newfs/newfs.c#n399 > > It changes the sectorsize back down to 512 from whatever it should > be, which means that the calculation in mkfs.c becomes off. I'd file > a bug report and get someone who knows FFS to look at it. I tried to > change mkfs.c to use realsectorsize isntead, so fsbtodb is set to 0, but > then it break ffsinfo, because it's calculations are likely wrong. Thank you very much for looking into this. I'll try to draw Kirk's attention to this issue (he is also in this thread, but a different sub-thread). >>> fsck calculates the sector size via (/sbin/fsck_ffs/setup.c): >>> dev_bsize = sblock.fs_fsize / fsbtodb(&sblock, 1); >>> >>> and fsbtodb: >>> ../../sys/ufs/ffs/fs.h:#define fsbtodb(fs, b) ((daddr_t)(b) << (fs)->fs_fsbtodb) >>> >>>> fsize 4096 shift 12 mask 0xfffff000 >>>> frag 8 shift 3 fsbtodb 3 >>> >>> fsize / (1 << 3) == 4096 / 8 == 512. >>> >>> so, likely updating fsbtodb to be 0 instead of 3 would fix this. I'm not >>> sure how to do this though, as tunefs and fsdb don't seem to have options >>> to do this, and likely you'll want to update all the superblocks w/ this >>> new value. > -- Andriy Gapon