mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH master] partition: fix reference to wrong cdev in warning message
@ 2025-03-18  8:24 Ahmad Fatoum
  2025-03-18 10:22 ` Sascha Hauer
  2025-03-18 11:16 ` Uwe Kleine-König
  0 siblings, 2 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2025-03-18  8:24 UTC (permalink / raw)
  To: barebox; +Cc: Uwe Kleine-König, Ahmad Fatoum

For MBR and GPT, barebox creates links to the partitions, so they can be
referenced both by index and partition label.

Failing to create a link is not an error, but results in a warning
message. The current message claims that the link was pointing at the
parent block device's cdev, but it actually was pointing at the child
partition. Fix that.

Reported-by: Uwe Kleine-König <uwe@kleine-koenig.org>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 common/partitions.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/partitions.c b/common/partitions.c
index 7562536cf9b8..bc90f51f6112 100644
--- a/common/partitions.c
+++ b/common/partitions.c
@@ -63,7 +63,7 @@ static int register_one_partition(struct block_device *blk, struct partition *pa
 	ret = devfs_create_link(cdev, partition_name);
 	if (ret)
 		dev_warn(blk->dev, "Failed to create link from %s to %s\n",
-			 partition_name, blk->cdev.name);
+			 partition_name, cdev->name);
 	free(partition_name);
 
 	return 0;
-- 
2.39.5




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH master] partition: fix reference to wrong cdev in warning message
  2025-03-18  8:24 [PATCH master] partition: fix reference to wrong cdev in warning message Ahmad Fatoum
@ 2025-03-18 10:22 ` Sascha Hauer
  2025-03-18 11:16 ` Uwe Kleine-König
  1 sibling, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2025-03-18 10:22 UTC (permalink / raw)
  To: barebox, Ahmad Fatoum; +Cc: Uwe Kleine-König


On Tue, 18 Mar 2025 09:24:35 +0100, Ahmad Fatoum wrote:
> For MBR and GPT, barebox creates links to the partitions, so they can be
> referenced both by index and partition label.
> 
> Failing to create a link is not an error, but results in a warning
> message. The current message claims that the link was pointing at the
> parent block device's cdev, but it actually was pointing at the child
> partition. Fix that.
> 
> [...]

Applied, thanks!

[1/1] partition: fix reference to wrong cdev in warning message
      https://git.pengutronix.de/cgit/barebox/commit/?id=a0ba27e06535 (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH master] partition: fix reference to wrong cdev in warning message
  2025-03-18  8:24 [PATCH master] partition: fix reference to wrong cdev in warning message Ahmad Fatoum
  2025-03-18 10:22 ` Sascha Hauer
@ 2025-03-18 11:16 ` Uwe Kleine-König
  2025-03-18 11:23   ` Ahmad Fatoum
  1 sibling, 1 reply; 5+ messages in thread
From: Uwe Kleine-König @ 2025-03-18 11:16 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

[-- Attachment #1: Type: text/plain, Size: 2068 bytes --]

On Tue, Mar 18, 2025 at 09:24:35AM +0100, Ahmad Fatoum wrote:
> For MBR and GPT, barebox creates links to the partitions, so they can be
> referenced both by index and partition label.
> 
> Failing to create a link is not an error, but results in a warning
> message. The current message claims that the link was pointing at the
> parent block device's cdev, but it actually was pointing at the child
> partition. Fix that.
> 
> Reported-by: Uwe Kleine-König <uwe@kleine-koenig.org>
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  common/partitions.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/common/partitions.c b/common/partitions.c
> index 7562536cf9b8..bc90f51f6112 100644
> --- a/common/partitions.c
> +++ b/common/partitions.c
> @@ -63,7 +63,7 @@ static int register_one_partition(struct block_device *blk, struct partition *pa
>  	ret = devfs_create_link(cdev, partition_name);
>  	if (ret)
>  		dev_warn(blk->dev, "Failed to create link from %s to %s\n",
> -			 partition_name, blk->cdev.name);
> +			 partition_name, cdev->name);

This improves the error messages on my ts433 from

	WARNING: mmc0: Failed to create link from mmc0.primary to mmc0
	WARNING: mmc0: Failed to create link from mmc0.primary to mmc0
	WARNING: mmc0: Failed to create link from mmc0.primary to mmc0
	WARNING: mmc0: Failed to create link from mmc0.primary to mmc0
	WARNING: mmc0: Failed to create link from mmc0.primary to mmc0

to 

	WARNING: mmc0: Failed to create link from mmc0.primary to mmc0.2
	WARNING: mmc0: Failed to create link from mmc0.primary to mmc0.3
	WARNING: mmc0: Failed to create link from mmc0.primary to mmc0.4
	WARNING: mmc0: Failed to create link from mmc0.primary to mmc0.5
	WARNING: mmc0: Failed to create link from mmc0.primary to mmc0.6

I still don't understand why barebox intends to create mmc0.primary for
all these partitions, but still it's an obviously right improvement.

Acked-by: Uwe Kleine-König <uwe@kleine-koenig.org>

Best regards and thanks
Uwe

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH master] partition: fix reference to wrong cdev in warning message
  2025-03-18 11:16 ` Uwe Kleine-König
@ 2025-03-18 11:23   ` Ahmad Fatoum
  2025-03-18 11:31     ` Uwe Kleine-König
  0 siblings, 1 reply; 5+ messages in thread
From: Ahmad Fatoum @ 2025-03-18 11:23 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: barebox

Hello Uwe,

On 3/18/25 12:16, Uwe Kleine-König wrote:
> This improves the error messages on my ts433 from
> 
> 	WARNING: mmc0: Failed to create link from mmc0.primary to mmc0
> 	WARNING: mmc0: Failed to create link from mmc0.primary to mmc0
> 	WARNING: mmc0: Failed to create link from mmc0.primary to mmc0
> 	WARNING: mmc0: Failed to create link from mmc0.primary to mmc0
> 	WARNING: mmc0: Failed to create link from mmc0.primary to mmc0
> 
> to 
> 
> 	WARNING: mmc0: Failed to create link from mmc0.primary to mmc0.2
> 	WARNING: mmc0: Failed to create link from mmc0.primary to mmc0.3
> 	WARNING: mmc0: Failed to create link from mmc0.primary to mmc0.4
> 	WARNING: mmc0: Failed to create link from mmc0.primary to mmc0.5
> 	WARNING: mmc0: Failed to create link from mmc0.primary to mmc0.6
> 
> I still don't understand why barebox intends to create mmc0.primary for
> all these partitions, but still it's an obviously right improvement.

Thanks for testing. I still suspect that you have multiple on-disk
partitions with the same label. What does lsblk -o name,label,partlabel
say?

Cheers,
Ahmad

> 
> Acked-by: Uwe Kleine-König <uwe@kleine-koenig.org>
> 
> Best regards and thanks
> Uwe




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH master] partition: fix reference to wrong cdev in warning message
  2025-03-18 11:23   ` Ahmad Fatoum
@ 2025-03-18 11:31     ` Uwe Kleine-König
  0 siblings, 0 replies; 5+ messages in thread
From: Uwe Kleine-König @ 2025-03-18 11:31 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

[-- Attachment #1: Type: text/plain, Size: 1636 bytes --]

Hello Ahmad,

On Tue, Mar 18, 2025 at 12:23:19PM +0100, Ahmad Fatoum wrote:
> On 3/18/25 12:16, Uwe Kleine-König wrote:
> > This improves the error messages on my ts433 from
> > 
> > 	WARNING: mmc0: Failed to create link from mmc0.primary to mmc0
> > 	WARNING: mmc0: Failed to create link from mmc0.primary to mmc0
> > 	WARNING: mmc0: Failed to create link from mmc0.primary to mmc0
> > 	WARNING: mmc0: Failed to create link from mmc0.primary to mmc0
> > 	WARNING: mmc0: Failed to create link from mmc0.primary to mmc0
> > 
> > to 
> > 
> > 	WARNING: mmc0: Failed to create link from mmc0.primary to mmc0.2
> > 	WARNING: mmc0: Failed to create link from mmc0.primary to mmc0.3
> > 	WARNING: mmc0: Failed to create link from mmc0.primary to mmc0.4
> > 	WARNING: mmc0: Failed to create link from mmc0.primary to mmc0.5
> > 	WARNING: mmc0: Failed to create link from mmc0.primary to mmc0.6
> > 
> > I still don't understand why barebox intends to create mmc0.primary for
> > all these partitions, but still it's an obviously right improvement.
> 
> Thanks for testing. I still suspect that you have multiple on-disk
> partitions with the same label. What does lsblk -o name,label,partlabel
> say?

indeed:

	# lsblk -o name,label,partlabel /dev/mmcblk0
	NAME        LABEL          PARTLABEL
	mmcblk0
	├─mmcblk0p1                uboot
	├─mmcblk0p2 QTS_BOOT_PART2 primary
	├─mmcblk0p3 QTS_BOOT_PART3 primary
	├─mmcblk0p4                primary
	├─mmcblk0p5                primary
	├─mmcblk0p6                primary
	└─mmcblk0p7                primary

Best regards
Uwe

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-03-18 11:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-18  8:24 [PATCH master] partition: fix reference to wrong cdev in warning message Ahmad Fatoum
2025-03-18 10:22 ` Sascha Hauer
2025-03-18 11:16 ` Uwe Kleine-König
2025-03-18 11:23   ` Ahmad Fatoum
2025-03-18 11:31     ` Uwe Kleine-König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox