diff mbox series

Regression in auto-mounting mtd squashfs partitions

Message ID 47b0c8fe-fc44-14c4-83e6-0b14c26d2b26@nbd.name
State Accepted
Delegated to: Felix Fietkau
Headers show
Series Regression in auto-mounting mtd squashfs partitions | expand

Commit Message

Felix Fietkau April 10, 2021, 2:04 p.m. UTC
Hi Daniel,

it seems to me that your commit 2809d0000744 ("kernel: support FIT
partition parser on mtdblock devices") is causing a regression in
mounting squashfs rootfs when CONFIG_FIT_PARTITION is enabled.
The following workaround fixes it, but maybe you can make a better fix,
since you're more familiar with the code.

- Felix

Comments

Daniel Golle April 10, 2021, 2:33 p.m. UTC | #1
On Sat, Apr 10, 2021 at 04:04:28PM +0200, Felix Fietkau wrote:
> Hi Daniel,
> 
> it seems to me that your commit 2809d0000744 ("kernel: support FIT
> partition parser on mtdblock devices") is causing a regression in
> mounting squashfs rootfs when CONFIG_FIT_PARTITION is enabled.
> The following workaround fixes it, but maybe you can make a better fix,
> since you're more familiar with the code.

No, I just forgot that we are also making assumptions about the mtdblock
device minor number in our own patches...
The fix looks good to me and certainly won't break devices that are
actually making of the new external-data FIT images (as ROOT_DEV is
then set by the FIT block partition parser in a generic way and no
'rootfs' MTD partition exists in that case).

Acked-by: Daniel Golle <daniel@makrotopia.org>

> 
> - Felix
> 
> --- a/drivers/mtd/mtdcore.c
> +++ b/drivers/mtd/mtdcore.c
> @@ -699,9 +699,13 @@ int add_mtd_device(struct mtd_info *mtd)
>  	if (!strcmp(mtd->name, "rootfs") &&
>  	    IS_ENABLED(CONFIG_MTD_ROOTFS_ROOT_DEV) &&
>  	    ROOT_DEV == 0) {
> +		unsigned int index = mtd->index;
>  		pr_notice("mtd: device %d (%s) set to be root filesystem\n",
>  			  mtd->index, mtd->name);
> -		ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, mtd->index);
> +#ifdef CONFIG_FIT_PARTITION
> +		index <<= 1;
> +#endif
> +		ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, index);
>  	}
>  
>  	return 0;
> 
> 
> 
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Felix Fietkau April 10, 2021, 3:03 p.m. UTC | #2
On 2021-04-10 16:33, Daniel Golle wrote:
> On Sat, Apr 10, 2021 at 04:04:28PM +0200, Felix Fietkau wrote:
>> Hi Daniel,
>> 
>> it seems to me that your commit 2809d0000744 ("kernel: support FIT
>> partition parser on mtdblock devices") is causing a regression in
>> mounting squashfs rootfs when CONFIG_FIT_PARTITION is enabled.
>> The following workaround fixes it, but maybe you can make a better fix,
>> since you're more familiar with the code.
> 
> No, I just forgot that we are also making assumptions about the mtdblock
> device minor number in our own patches...
> The fix looks good to me and certainly won't break devices that are
> actually making of the new external-data FIT images (as ROOT_DEV is
> then set by the FIT block partition parser in a generic way and no
> 'rootfs' MTD partition exists in that case).
> 
> Acked-by: Daniel Golle <daniel@makrotopia.org>
Fix pushed, thanks for the fast reply.

- Felix
diff mbox series

Patch

--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -699,9 +699,13 @@  int add_mtd_device(struct mtd_info *mtd)
 	if (!strcmp(mtd->name, "rootfs") &&
 	    IS_ENABLED(CONFIG_MTD_ROOTFS_ROOT_DEV) &&
 	    ROOT_DEV == 0) {
+		unsigned int index = mtd->index;
 		pr_notice("mtd: device %d (%s) set to be root filesystem\n",
 			  mtd->index, mtd->name);
-		ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, mtd->index);
+#ifdef CONFIG_FIT_PARTITION
+		index <<= 1;
+#endif
+		ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, index);
 	}
 
 	return 0;