mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <sha@pengutronix.de>
To: Victor BERTIN <vbertin@witekio.com>
Cc: "barebox@lists.infradead.org" <barebox@lists.infradead.org>
Subject: Re: Fail to register logical partition because it overlaps with the extended partition
Date: Tue, 5 Dec 2023 11:34:22 +0100	[thread overview]
Message-ID: <20231205103422.GB1057032@pengutronix.de> (raw)
In-Reply-To: <PAXP192MB12457D6FCCD50380EA71D63FA786A@PAXP192MB1245.EURP192.PROD.OUTLOOK.COM>

Hi Victor,

On Mon, Dec 04, 2023 at 03:04:37PM +0000, Victor BERTIN wrote:
> Hello All,
> 
> We are using Barebox v2022.12.0 on a MSC SM2S-IMX8MP SoM.
> 
> We witness an error happening when registering the first logical partition of our extended partition :
> ERROR: New partition mmc2.4 (0x46600400-0xc68003ff) on mmc2 overlaps with partition mmc2.3 (0x46600200-0x466005ff), not creating it
> ERROR: mmc2: Failed to register partition 4 on mmc2 (-22)
> 
> However, Linux does not complain and all partitions are properly registered :
> [root@imx8-evo:~]# lsblk
> NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
> mmcblk2      179:0    0 14.6G  0 disk
> |-mmcblk2p1  179:1    0   66M  0 part
> |-mmcblk2p2  179:2    0    1G  0 part /
> |-mmcblk2p3  179:3    0   34M  0 part /rwdisk/systemrw
> |-mmcblk2p4  179:4    0    1K  0 part
> |-mmcblk2p5  179:5    0    2G  0 part /rwdisk/app
> |-mmcblk2p6  179:6    0  130M  0 part /var/log
> `-mmcblk2p7  179:7    0   32M  0 part /rwdisk/conf
> mmcblk2boot0 179:32   0    4M  1 disk
> mmcblk2boot1 179:64   0    4M  1 disk
> 
> Since 84ea37e4580cabc2a49edc4e2c62b45a752771fc, extended partitions
> are registered with a size of 2 sectors. Our extended partition still
> manages to overlap with the first logical partition that it contains.
> A simple trick is to reduce the registration size to 1 sector, however
> we are not sure of the side effects of such change.

I don't think this has any side effects. In the end an extended
partition is just a container for logical partitions and should not be
used directly anyway.

I just realized we do not check if the logical partitions actually fit
into the extended partition. It might be better do handle the logical
partitions as children of the extended partition, but I am currently not
very familiar with the code. Anyway, until we are there feel free to
send a patch changing the size of an extended partition to 1 sector.

> 
> Any idea why such issue could happen ?

I am not sure if Linux checks for overlapping partitions at all. From
looking at the code I'd say no.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



      reply	other threads:[~2023-12-05 10:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-04 15:04 Victor BERTIN
2023-12-05 10:34 ` Sascha Hauer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231205103422.GB1057032@pengutronix.de \
    --to=sha@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=vbertin@witekio.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox