diff mbox series

[OpenWrt-Devel] Revert "kernel: rewrite run_parsers_by_type() to use add_mtd_partitions()"

Message ID 20200302125820.12353-1-ynezz@true.cz
State Not Applicable
Delegated to: Petr Štetiar
Headers show
Series [OpenWrt-Devel] Revert "kernel: rewrite run_parsers_by_type() to use add_mtd_partitions()" | expand

Commit Message

Petr Štetiar March 2, 2020, 12:58 p.m. UTC
This reverts commit 15a0701cdde8eeae2a54880b813cdb8cdc09a384.

Seems like this patch has introduced some regressions on the ramips
target which is still on 4.14 kernel as this commit touches only 4.14
kernel patches.

 jffs2: Erase at 0x00378000 failed immediately: errno -22
 jffs2: Node CRC ffffffff != calculated CRC f09e7845 for node at 00c08510

Ref: FS#2837, FS#2862
Ref: https://forum.openwrt.org/t/jffs2-partition-not-save-new-package-installation-or-save-settings
Cc: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Petr Štetiar <ynezz@true.cz>
---
 ...for-different-partition-parser-types.patch | 33 ++++++++++++-------
 ...arsers-for-rootfs-and-firmware-split.patch |  4 +--
 .../404-mtd-add-more-helper-functions.patch   |  2 +-
 3 files changed, 24 insertions(+), 15 deletions(-)

Comments

Enrico Mioso March 2, 2020, 1:22 p.m. UTC | #1
Ok, reverting this commit fixes my issue. So please guys, do rever this.



On Mon, 2 Mar 2020, Petr Štetiar wrote:

> Date: Mon, 2 Mar 2020 13:58:20
> From: Petr Štetiar <ynezz@true.cz>
> To: openwrt-devel@lists.openwrt.org
> Cc: Rafał Miłecki <rafal@milecki.pl>, Petr Štetiar <ynezz@true.cz>
> Subject: [OpenWrt-Devel] [PATCH] Revert
>     "kernel: rewrite run_parsers_by_type() to use add_mtd_partitions()"
> 
> This reverts commit 15a0701cdde8eeae2a54880b813cdb8cdc09a384.
>
> Seems like this patch has introduced some regressions on the ramips
> target which is still on 4.14 kernel as this commit touches only 4.14
> kernel patches.
>
> jffs2: Erase at 0x00378000 failed immediately: errno -22
> jffs2: Node CRC ffffffff != calculated CRC f09e7845 for node at 00c08510
>
> Ref: FS#2837, FS#2862
> Ref: https://forum.openwrt.org/t/jffs2-partition-not-save-new-package-installation-or-save-settings
> Cc: Rafał Miłecki <rafal@milecki.pl>
> Signed-off-by: Petr Štetiar <ynezz@true.cz>
> ---
> ...for-different-partition-parser-types.patch | 33 ++++++++++++-------
> ...arsers-for-rootfs-and-firmware-split.patch |  4 +--
> .../404-mtd-add-more-helper-functions.patch   |  2 +-
> 3 files changed, 24 insertions(+), 15 deletions(-)
>
> diff --git a/target/linux/generic/pending-4.14/401-mtd-add-support-for-different-partition-parser-types.patch b/target/linux/generic/pending-4.14/401-mtd-add-support-for-different-partition-parser-types.patch
> index ae13112ef6d0..057d47368443 100644
> --- a/target/linux/generic/pending-4.14/401-mtd-add-support-for-different-partition-parser-types.patch
> +++ b/target/linux/generic/pending-4.14/401-mtd-add-support-for-different-partition-parser-types.patch
> @@ -20,35 +20,44 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
>
>  /*
>   * Given a pointer to the MTD object in the mtd_part structure, we can retrieve
> -@@ -762,6 +766,27 @@ int mtd_del_partition(struct mtd_info *m
> +@@ -762,6 +766,36 @@ int mtd_del_partition(struct mtd_info *m
>  }
>  EXPORT_SYMBOL_GPL(mtd_del_partition);
> 
> +static int
> +run_parsers_by_type(struct mtd_part *slave, enum mtd_parser_type type)
> +{
> -+	struct mtd_partitions pparts = { };
> -+	int err;
> ++	struct mtd_partition *parts;
> ++	int nr_parts;
> ++	int i;
> +
> -+	pparts.nr_parts = parse_mtd_partitions_by_type(&slave->mtd, type,
> -+						       &pparts.parts, NULL);
> -+	if (pparts.nr_parts <= 0)
> -+		return pparts.nr_parts;
> ++	nr_parts = parse_mtd_partitions_by_type(&slave->mtd, type, (const struct mtd_partition **)&parts,
> ++						NULL);
> ++	if (nr_parts <= 0)
> ++		return nr_parts;
> +
> -+	if (WARN_ON(!pparts.parts))
> ++	if (WARN_ON(!parts))
> +		return 0;
> +
> -+	err = add_mtd_partitions(&slave->mtd, pparts.parts, pparts.nr_parts);
> ++	for (i = 0; i < nr_parts; i++) {
> ++		/* adjust partition offsets */
> ++		parts[i].offset += slave->offset;
> +
> -+	kfree(pparts.parts);
> ++		mtd_add_partition(slave->parent,
> ++				  parts[i].name,
> ++				  parts[i].offset,
> ++				  parts[i].size);
> ++	}
> ++
> ++	kfree(parts);
> +
> -+	return err ? err : pparts.nr_parts;
> ++	return nr_parts;
> +}
> +
>  #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME
>  #define SPLIT_FIRMWARE_NAME	CONFIG_MTD_SPLIT_FIRMWARE_NAME
>  #else
> -@@ -1147,6 +1172,61 @@ void mtd_part_parser_cleanup(struct mtd_
> +@@ -1147,6 +1181,61 @@ void mtd_part_parser_cleanup(struct mtd_
>  	}
>  }
> 
> diff --git a/target/linux/generic/pending-4.14/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch b/target/linux/generic/pending-4.14/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch
> index 149c328ac4d5..2cc06dd463b3 100644
> --- a/target/linux/generic/pending-4.14/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch
> +++ b/target/linux/generic/pending-4.14/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch
> @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
> 
> --- a/drivers/mtd/mtdpart.c
> +++ b/drivers/mtd/mtdpart.c
> -@@ -795,6 +795,7 @@ run_parsers_by_type(struct mtd_part *sla
> +@@ -804,6 +804,7 @@ run_parsers_by_type(struct mtd_part *sla
>
>  static void split_firmware(struct mtd_info *master, struct mtd_part *part)
>  {
> @@ -18,7 +18,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
>  }
>
>  static void mtd_partition_split(struct mtd_info *master, struct mtd_part *part)
> -@@ -804,6 +805,12 @@ static void mtd_partition_split(struct m
> +@@ -813,6 +814,12 @@ static void mtd_partition_split(struct m
>  	if (rootfs_found)
>  		return;
> 
> diff --git a/target/linux/generic/pending-4.14/404-mtd-add-more-helper-functions.patch b/target/linux/generic/pending-4.14/404-mtd-add-more-helper-functions.patch
> index d1a32872af21..7b481ffb47a5 100644
> --- a/target/linux/generic/pending-4.14/404-mtd-add-more-helper-functions.patch
> +++ b/target/linux/generic/pending-4.14/404-mtd-add-more-helper-functions.patch
> @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
> 
> --- a/drivers/mtd/mtdpart.c
> +++ b/drivers/mtd/mtdpart.c
> -@@ -1251,6 +1251,24 @@ int mtd_is_partition(const struct mtd_in
> +@@ -1260,6 +1260,24 @@ int mtd_is_partition(const struct mtd_in
>  }
>  EXPORT_SYMBOL_GPL(mtd_is_partition);
> 
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Piotr Dymacz March 6, 2020, 8:09 a.m. UTC | #2
Hi Petr, Rafał,

On 02.03.2020 13:58, Petr Štetiar wrote:
> This reverts commit 15a0701cdde8eeae2a54880b813cdb8cdc09a384.
> 
> Seems like this patch has introduced some regressions on the ramips
> target which is still on 4.14 kernel as this commit touches only 4.14
> kernel patches.
> 
>   jffs2: Erase at 0x00378000 failed immediately: errno -22
>   jffs2: Node CRC ffffffff != calculated CRC f09e7845 for node at 00c08510
> 
> Ref: FS#2837, FS#2862

Fixes also very serious (erase of ART) FS#2864.
Ref: https://bugs.openwrt.org/index.php?do=details&task_id=2864
Rafał Miłecki March 6, 2020, 8:14 a.m. UTC | #3
On 2020-03-06 09:09, Piotr Dymacz wrote:
> Hi Petr, Rafał,
> 
> On 02.03.2020 13:58, Petr Štetiar wrote:
>> This reverts commit 15a0701cdde8eeae2a54880b813cdb8cdc09a384.
>> 
>> Seems like this patch has introduced some regressions on the ramips
>> target which is still on 4.14 kernel as this commit touches only 4.14
>> kernel patches.
>> 
>>   jffs2: Erase at 0x00378000 failed immediately: errno -22
>>   jffs2: Node CRC ffffffff != calculated CRC f09e7845 for node at 
>> 00c08510
>> 
>> Ref: FS#2837, FS#2862
> 
> Fixes also very serious (erase of ART) FS#2864.
> Ref: https://bugs.openwrt.org/index.php?do=details&task_id=2864

I'll be back looking at this in few hours. I'm finishing my big
debugging/research on kernel running OOM right now.
Enrico Mioso March 7, 2020, 4:58 p.m. UTC | #4
Hello guys!
why can't we revert this patch right now, while working out what's goin on?
thank you! and sorry for the insistence.

Enrico


On Fri, 6 Mar 2020, Piotr Dymacz wrote:

> Date: Fri, 6 Mar 2020 09:09:15
> From: Piotr Dymacz <pepe2k@gmail.com>
> To: Petr Štetiar <ynezz@true.cz>, openwrt-devel@lists.openwrt.org
> Cc: Rafał Miłecki <rafal@milecki.pl>
> Subject: Re: [OpenWrt-Devel] [PATCH] Revert
>     "kernel: rewrite run_parsers_by_type() to use add_mtd_partitions()"
> 
> Hi Petr, Rafał,
>
> On 02.03.2020 13:58, Petr Štetiar wrote:
>> This reverts commit 15a0701cdde8eeae2a54880b813cdb8cdc09a384.
>> 
>> Seems like this patch has introduced some regressions on the ramips
>> target which is still on 4.14 kernel as this commit touches only 4.14
>> kernel patches.
>>
>>   jffs2: Erase at 0x00378000 failed immediately: errno -22
>>   jffs2: Node CRC ffffffff != calculated CRC f09e7845 for node at 00c08510
>> 
>> Ref: FS#2837, FS#2862
>
> Fixes also very serious (erase of ART) FS#2864.
> Ref: https://bugs.openwrt.org/index.php?do=details&task_id=2864
>
> -- 
> Cheers,
> Piotr
>
>> Ref: 
> https://forum.openwrt.org/t/jffs2-partition-not-save-new-package-installation-or-save-settings
>> Cc: Rafał Miłecki <rafal@milecki.pl>
>> Signed-off-by: Petr Štetiar <ynezz@true.cz>
>> ---
>>   ...for-different-partition-parser-types.patch | 33 ++++++++++++-------
>>   ...arsers-for-rootfs-and-firmware-split.patch |  4 +--
>>   .../404-mtd-add-more-helper-functions.patch   |  2 +-
>>   3 files changed, 24 insertions(+), 15 deletions(-)
>> 
>> diff --git 
> a/target/linux/generic/pending-4.14/401-mtd-add-support-for-different-partition-parser-types.patch 
> b/target/linux/generic/pending-4.14/401-mtd-add-support-for-different-partition-parser-types.patch
>> index ae13112ef6d0..057d47368443 100644
>> --- 
> a/target/linux/generic/pending-4.14/401-mtd-add-support-for-different-partition-parser-types.patch
>> +++ 
> b/target/linux/generic/pending-4.14/401-mtd-add-support-for-different-partition-parser-types.patch
>> @@ -20,35 +20,44 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
>>
>>    /*
>>     * Given a pointer to the MTD object in the mtd_part structure, we can 
> retrieve
>> -@@ -762,6 +766,27 @@ int mtd_del_partition(struct mtd_info *m
>> +@@ -762,6 +766,36 @@ int mtd_del_partition(struct mtd_info *m
>>    }
>>    EXPORT_SYMBOL_GPL(mtd_del_partition);
>>
>>   +static int
>>   +run_parsers_by_type(struct mtd_part *slave, enum mtd_parser_type type)
>>   +{
>> -+	struct mtd_partitions pparts = { };
>> -+	int err;
>> ++	struct mtd_partition *parts;
>> ++	int nr_parts;
>> ++	int i;
>>   +
>> -+	pparts.nr_parts = parse_mtd_partitions_by_type(&slave->mtd, type,
>> -+						       &pparts.parts, NULL);
>> -+	if (pparts.nr_parts <= 0)
>> -+		return pparts.nr_parts;
>> ++	nr_parts = parse_mtd_partitions_by_type(&slave->mtd, type, (const 
> struct mtd_partition **)&parts,
>> ++						NULL);
>> ++	if (nr_parts <= 0)
>> ++		return nr_parts;
>>   +
>> -+	if (WARN_ON(!pparts.parts))
>> ++	if (WARN_ON(!parts))
>>   +		return 0;
>>   +
>> -+	err = add_mtd_partitions(&slave->mtd, pparts.parts, pparts.nr_parts);
>> ++	for (i = 0; i < nr_parts; i++) {
>> ++		/* adjust partition offsets */
>> ++		parts[i].offset += slave->offset;
>>   +
>> -+	kfree(pparts.parts);
>> ++		mtd_add_partition(slave->parent,
>> ++				  parts[i].name,
>> ++				  parts[i].offset,
>> ++				  parts[i].size);
>> ++	}
>> ++
>> ++	kfree(parts);
>>   +
>> -+	return err ? err : pparts.nr_parts;
>> ++	return nr_parts;
>>   +}
>>   +
>>    #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME
>>    #define SPLIT_FIRMWARE_NAME	CONFIG_MTD_SPLIT_FIRMWARE_NAME
>>    #else
>> -@@ -1147,6 +1172,61 @@ void mtd_part_parser_cleanup(struct mtd_
>> +@@ -1147,6 +1181,61 @@ void mtd_part_parser_cleanup(struct mtd_
>>    	}
>>    }
>> 
>> diff --git 
> a/target/linux/generic/pending-4.14/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch 
> b/target/linux/generic/pending-4.14/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch
>> index 149c328ac4d5..2cc06dd463b3 100644
>> --- 
> a/target/linux/generic/pending-4.14/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch
>> +++ 
> b/target/linux/generic/pending-4.14/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch
>> @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
>>
>>   --- a/drivers/mtd/mtdpart.c
>>   +++ b/drivers/mtd/mtdpart.c
>> -@@ -795,6 +795,7 @@ run_parsers_by_type(struct mtd_part *sla
>> +@@ -804,6 +804,7 @@ run_parsers_by_type(struct mtd_part *sla
>>
>>    static void split_firmware(struct mtd_info *master, struct mtd_part 
> *part)
>>    {
>> @@ -18,7 +18,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
>>    }
>>
>>    static void mtd_partition_split(struct mtd_info *master, struct mtd_part 
> *part)
>> -@@ -804,6 +805,12 @@ static void mtd_partition_split(struct m
>> +@@ -813,6 +814,12 @@ static void mtd_partition_split(struct m
>>    	if (rootfs_found)
>>    		return;
>> 
>> diff --git 
> a/target/linux/generic/pending-4.14/404-mtd-add-more-helper-functions.patch 
> b/target/linux/generic/pending-4.14/404-mtd-add-more-helper-functions.patch
>> index d1a32872af21..7b481ffb47a5 100644
>> --- 
> a/target/linux/generic/pending-4.14/404-mtd-add-more-helper-functions.patch
>> +++ 
> b/target/linux/generic/pending-4.14/404-mtd-add-more-helper-functions.patch
>> @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
>>
>>   --- a/drivers/mtd/mtdpart.c
>>   +++ b/drivers/mtd/mtdpart.c
>> -@@ -1251,6 +1251,24 @@ int mtd_is_partition(const struct mtd_in
>> +@@ -1260,6 +1260,24 @@ int mtd_is_partition(const struct mtd_in
>>    }
>>    EXPORT_SYMBOL_GPL(mtd_is_partition);
>> 
>> 
>> _______________________________________________
>> openwrt-devel mailing list
>> openwrt-devel@lists.openwrt.org
>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>> 
>
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>
diff mbox series

Patch

diff --git a/target/linux/generic/pending-4.14/401-mtd-add-support-for-different-partition-parser-types.patch b/target/linux/generic/pending-4.14/401-mtd-add-support-for-different-partition-parser-types.patch
index ae13112ef6d0..057d47368443 100644
--- a/target/linux/generic/pending-4.14/401-mtd-add-support-for-different-partition-parser-types.patch
+++ b/target/linux/generic/pending-4.14/401-mtd-add-support-for-different-partition-parser-types.patch
@@ -20,35 +20,44 @@  Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  
  /*
   * Given a pointer to the MTD object in the mtd_part structure, we can retrieve
-@@ -762,6 +766,27 @@ int mtd_del_partition(struct mtd_info *m
+@@ -762,6 +766,36 @@ int mtd_del_partition(struct mtd_info *m
  }
  EXPORT_SYMBOL_GPL(mtd_del_partition);
  
 +static int
 +run_parsers_by_type(struct mtd_part *slave, enum mtd_parser_type type)
 +{
-+	struct mtd_partitions pparts = { };
-+	int err;
++	struct mtd_partition *parts;
++	int nr_parts;
++	int i;
 +
-+	pparts.nr_parts = parse_mtd_partitions_by_type(&slave->mtd, type,
-+						       &pparts.parts, NULL);
-+	if (pparts.nr_parts <= 0)
-+		return pparts.nr_parts;
++	nr_parts = parse_mtd_partitions_by_type(&slave->mtd, type, (const struct mtd_partition **)&parts,
++						NULL);
++	if (nr_parts <= 0)
++		return nr_parts;
 +
-+	if (WARN_ON(!pparts.parts))
++	if (WARN_ON(!parts))
 +		return 0;
 +
-+	err = add_mtd_partitions(&slave->mtd, pparts.parts, pparts.nr_parts);
++	for (i = 0; i < nr_parts; i++) {
++		/* adjust partition offsets */
++		parts[i].offset += slave->offset;
 +
-+	kfree(pparts.parts);
++		mtd_add_partition(slave->parent,
++				  parts[i].name,
++				  parts[i].offset,
++				  parts[i].size);
++	}
++
++	kfree(parts);
 +
-+	return err ? err : pparts.nr_parts;
++	return nr_parts;
 +}
 +
  #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME
  #define SPLIT_FIRMWARE_NAME	CONFIG_MTD_SPLIT_FIRMWARE_NAME
  #else
-@@ -1147,6 +1172,61 @@ void mtd_part_parser_cleanup(struct mtd_
+@@ -1147,6 +1181,61 @@ void mtd_part_parser_cleanup(struct mtd_
  	}
  }
  
diff --git a/target/linux/generic/pending-4.14/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch b/target/linux/generic/pending-4.14/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch
index 149c328ac4d5..2cc06dd463b3 100644
--- a/target/linux/generic/pending-4.14/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch
+++ b/target/linux/generic/pending-4.14/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch
@@ -10,7 +10,7 @@  Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
 
 --- a/drivers/mtd/mtdpart.c
 +++ b/drivers/mtd/mtdpart.c
-@@ -795,6 +795,7 @@ run_parsers_by_type(struct mtd_part *sla
+@@ -804,6 +804,7 @@ run_parsers_by_type(struct mtd_part *sla
  
  static void split_firmware(struct mtd_info *master, struct mtd_part *part)
  {
@@ -18,7 +18,7 @@  Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  }
  
  static void mtd_partition_split(struct mtd_info *master, struct mtd_part *part)
-@@ -804,6 +805,12 @@ static void mtd_partition_split(struct m
+@@ -813,6 +814,12 @@ static void mtd_partition_split(struct m
  	if (rootfs_found)
  		return;
  
diff --git a/target/linux/generic/pending-4.14/404-mtd-add-more-helper-functions.patch b/target/linux/generic/pending-4.14/404-mtd-add-more-helper-functions.patch
index d1a32872af21..7b481ffb47a5 100644
--- a/target/linux/generic/pending-4.14/404-mtd-add-more-helper-functions.patch
+++ b/target/linux/generic/pending-4.14/404-mtd-add-more-helper-functions.patch
@@ -11,7 +11,7 @@  Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
 
 --- a/drivers/mtd/mtdpart.c
 +++ b/drivers/mtd/mtdpart.c
-@@ -1251,6 +1251,24 @@ int mtd_is_partition(const struct mtd_in
+@@ -1260,6 +1260,24 @@ int mtd_is_partition(const struct mtd_in
  }
  EXPORT_SYMBOL_GPL(mtd_is_partition);