[parted-devel] [PATCH v2] libparted: Fail early when detecting nilfs2
Brian C. Lane
bcl at redhat.com
Tue Oct 15 17:58:20 BST 2024
On Mon, Oct 07, 2024 at 04:31:52PM +0200, Oldřich Jedlička wrote:
> so 6. 4. 2024 v 19:21 odesílatel Oldřich Jedlička <oldium.pro at gmail.com> napsal:
> >
> > When the disk is encrypted with TCG Opal HW encryption (supported by
> > cryptsetup 2.7.0+), the partition initially contains locked area, which
> > shows reading errors in kernel logs and may lead to configuring the disk
> > to work with lower reading speed. When the disk area is unlocked with
> > password, the reading succeeds. The beginning of the protected partition is
> > not locked and contains LUKS header, this is always readable.
> >
> > To work around the errors when reading from the locked area, try first
> > detecting nilfs2 at the beginning (may be an unprotected LUKS header area)
> > and only check the second superblock that is at the end of the area (and
> > possibly locked) if the first one is valid (meaning the partition is not
> > LUKS-protected).
> >
> > This is a change in behavior, but is consistent with the nilfs2 code, which
> > considers both superblocks mandatory, see [1].
> >
> > [1] https://github.com/nilfs-dev/nilfs-utils/blob/master/lib/sb.c#L135-L158
> >
> > Signed-off-by: Oldřich Jedlička <oldium.pro at gmail.com>
>
> Hi,
>
> just pinging here as a kind reminder. Could this be merged, please?
Thanks for the ping, sorry about that. It looks fine to me. If there
aren't any objections I'll merge it later this week (and add it to
Fedora Rawhide).
Thanks,
Brian
>
> Thanks.
>
> Regards,
> Oldrich.
>
> > ---
> > libparted/fs/nilfs2/nilfs2.c | 7 ++++---
> > 1 file changed, 4 insertions(+), 3 deletions(-)
> >
> > diff --git a/libparted/fs/nilfs2/nilfs2.c b/libparted/fs/nilfs2/nilfs2.c
> > index 6204542..40f8567 100644
> > --- a/libparted/fs/nilfs2/nilfs2.c
> > +++ b/libparted/fs/nilfs2/nilfs2.c
> > @@ -118,11 +118,12 @@ nilfs2_probe (PedGeometry* geom)
> >
> > if (ped_geometry_read(geom, buf, 0, sectors))
> > sb = (struct nilfs2_super_block*)(buf + 1024);
> > + if (!sb || !is_valid_nilfs_sb(sb))
> > + return NULL;
> > +
> > if (ped_geometry_read(geom, buff2, sb2off, sectors2))
> > sb2 = (struct nilfs2_super_block*)buff2;
> > -
> > - if ((!sb || !is_valid_nilfs_sb(sb)) &&
> > - (!sb2 || !is_valid_nilfs_sb(sb2)))
> > + if (!sb2 || !is_valid_nilfs_sb(sb2))
> > return NULL;
> >
> > /* reserve 4k bytes for secondary superblock */
> > --
> > 2.39.2
> >
>
--
Brian C. Lane (PST8PDT) - weldr.io - lorax - parted - pykickstart
More information about the parted-devel
mailing list