Skip to contentSkip to conversation

image_types_sparse: stop using ext2simg

PATCH In review Dmitry Baryshkov 2 participants 8 messages Aug 18, 2021 – Aug 30, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 image_types_sparse: stop using ext2simg

Under some conditions ext2simg can corrupt the file system (see
https://lore.kernel.org/linux-ext4/CAP71WjwVdqmLEq1NGWK36JkEd-i05YcAu4jeY6GFjsk6TS=Mtg@mail.gmail.com/).
This has been reproduced with the ext2simg currently found meta-oe's android-tools-native). Stop using ext2simg and always use img2simg. This results in bigger images, but without the risk of image corruption.

---
 meta-oe/classes/image_types_sparse.bbclass | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)
meta-oe/classes/image_types_sparse.bbclass +2 -10
index 65d980fd913f..4263593a8dd1 100644
@@ -2,15 +2,7 @@ inherit image_types
 
 CONVERSIONTYPES += "sparse"
 CONVERSION_CMD:sparse = " \
-    case "${type}" in \
-        ext*) \
-            ext2simg "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" \
-                     "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sparse" \
-            ;; \
-        *) \
-            img2simg "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" \
-                     "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sparse" \
-            ;; \
-    esac \
+    img2simg "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" \
+             "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sparse" \
 "
 CONVERSION_DEPENDS_sparse = "android-tools-native"
Signature · 1 line
2.30.2
#1 lore raw
Quoted 6 lines · Dmitry Baryshkov

Under some conditions ext2simg can corrupt the file system (see
https://lore.kernel.org/linux-ext4/CAP71WjwVdqmLEq1NGWK36JkEd-i05YcAu4jeY6GFjsk6TS=Mtg@mail.gmail.com/).
This has been reproduced with the ext2simg currently found meta-oe's android-tools-native). Stop using ext2simg and always use img2simg. This results in bigger images, but without the risk of image corruption.

how big are the images ?

Quoted 34 lines
---
 meta-oe/classes/image_types_sparse.bbclass | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)
meta-oe/classes/image_types_sparse.bbclass +2 -11
index 65d980fd913f..4263593a8dd1 100644
@@ -2,15 +2,7 @@ inherit image_types
 
 CONVERSIONTYPES += "sparse"
 CONVERSION_CMD:sparse = " \
-    case "${type}" in \
-        ext*) \
-            ext2simg "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" \
-                     "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sparse" \
-            ;; \
-        *) \
-            img2simg "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" \
-                     "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sparse" \
-            ;; \
-    esac \
+    img2simg "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" \
+             "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sparse" \
 "
 CONVERSION_DEPENDS_sparse = "android-tools-native"
--

2.30.2

#2 lore raw

ср, 18 авг. 2021 г. в 21:23, Khem Raj <[email protected]>:

Quoted 10 lines · Dmitry Baryshkov
Quoted 6 lines

Under some conditions ext2simg can corrupt the file system (see
https://lore.kernel.org/linux-ext4/CAP71WjwVdqmLEq1NGWK36JkEd-i05YcAu4jeY6GFjsk6TS=Mtg@mail.gmail.com/).
This has been reproduced with the ext2simg currently found meta-oe's android-tools-native). Stop using ext2simg and always use img2simg. This results in bigger images, but without the risk of image corruption.

how big are the images ?

Just checked. I've 1GB (964 MB) ext4 image. gzipped it takes 227 MB. Given that I got:
ext2simg - 518MB
img2simg - 655 MB

Quoted 35 lines
Quoted 35 lines
---
 meta-oe/classes/image_types_sparse.bbclass | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)
meta-oe/classes/image_types_sparse.bbclass +2 -11
index 65d980fd913f..4263593a8dd1 100644
@@ -2,15 +2,7 @@ inherit image_types
 
 CONVERSIONTYPES += "sparse"
 CONVERSION_CMD:sparse = " \
-    case "${type}" in \
-        ext*) \
-            ext2simg "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" \
-                     "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sparse" \
-            ;; \
-        *) \
-            img2simg "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" \
-                     "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sparse" \
-            ;; \
-    esac \
+    img2simg "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" \
+             "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sparse" \
 "
 CONVERSION_DEPENDS_sparse = "android-tools-native"
--

2.30.2

Signature · 2 lines
With best wishes
Dmitry
#3 lore raw
Quoted 12 lines · Dmitry Baryshkov

ср, 18 авг. 2021 г. в 21:23, Khem Raj <[email protected]>:

Quoted 2 lines

On Wed, Aug 18, 2021 at 8:39 AM Dmitry Baryshkov <[email protected]>

Quoted 3 lines · wrote:
Quoted 3 lines

Under some conditions ext2simg can corrupt the file system (see

https://lore.kernel.org/linux-ext4/CAP71WjwVdqmLEq1NGWK36JkEd-i05YcAu4jeY6GFjsk6TS=Mtg@mail.gmail.com/
).

Quoted 2 lines
Quoted 2 lines

This has been reproduced with the ext2simg currently found meta-oe's android-tools-native). Stop using ext2simg and always use img2simg.

This

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

results in bigger images, but without the risk of image corruption.

how big are the images ?

Just checked. I've 1GB (964 MB) ext4 image. gzipped it takes 227 MB. Given that I got:
ext2simg - 518MB
img2simg - 655 MB

Hmm so Choice is corrupted at times and small or big but not corrupted I guess we should take the second option as it seems more stable

Quoted 47 lines
Quoted 10 lines

Review

Quoted 10 lines
---
 meta-oe/classes/image_types_sparse.bbclass | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)
(quoted diff) +0 -0

b/meta-oe/classes/image_types_sparse.bbclass

Quoted 11 lines

meta-oe/classes/image_types_sparse.bbclass inherit image_types · line 8

Quoted 11 lines

index 65d980fd913f..4263593a8dd1 100644

meta-oe/classes/image_types_sparse.bbclass +0 -4
@@ -2,15 +2,7 @@ inherit image_types
 
 CONVERSIONTYPES += "sparse"
 CONVERSION_CMD:sparse = " \
-    case "${type}" in \
-        ext*) \
-            ext2simg "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" \
-

"${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sparse" \

Quoted 4 lines

meta-oe/classes/image_types_sparse.bbclass inherit image_types

Quoted 4 lines
meta-oe/classes/image_types_sparse.bbclass +0 -4
-            ;; \
-        *) \
-            img2simg "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" \
-

"${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sparse" \

Quoted 4 lines
Quoted 4 lines
meta-oe/classes/image_types_sparse.bbclass +2 -2
-            ;; \
-    esac \
+    img2simg "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" \
+             "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sparse" \
Quoted 8 lines
Quoted 8 lines
meta-oe/classes/image_types_sparse.bbclass +0 -1
 "
 CONVERSION_DEPENDS_sparse = "android-tools-native"
--

2.30.2

--
With best wishes
Dmitry

#4 lore raw

Hi,

пт, 20 авг. 2021 г. в 21:03, Khem Raj <[email protected]>:

Quoted 17 lines · Dmitry Baryshkov
Quoted 13 lines

ср, 18 авг. 2021 г. в 21:23, Khem Raj <[email protected]>:

Quoted 10 lines · Dmitry Baryshkov
Quoted 6 lines

Under some conditions ext2simg can corrupt the file system (see
https://lore.kernel.org/linux-ext4/CAP71WjwVdqmLEq1NGWK36JkEd-i05YcAu4jeY6GFjsk6TS=Mtg@mail.gmail.com/).
This has been reproduced with the ext2simg currently found meta-oe's android-tools-native). Stop using ext2simg and always use img2simg. This results in bigger images, but without the risk of image corruption.

how big are the images ?

Quoted 7 lines
Quoted 4 lines

Just checked. I've 1GB (964 MB) ext4 image. gzipped it takes 227 MB. Given that I got:
ext2simg - 518MB
img2simg - 655 MB

Hmm so Choice is corrupted at times and small or big but not corrupted I guess we should take the second option as it seems more stable

Pretty much so. I'd also settle for the second option. I've been hit by ext2simg, thus I had to send this patch. So, can we please get it queued/applied?

Quoted 39 lines
Quoted 39 lines
Quoted 25 lines
Quoted 25 lines
---
 meta-oe/classes/image_types_sparse.bbclass | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)
meta-oe/classes/image_types_sparse.bbclass +2 -10
index 65d980fd913f..4263593a8dd1 100644
@@ -2,15 +2,7 @@ inherit image_types
 
 CONVERSIONTYPES += "sparse"
 CONVERSION_CMD:sparse = " \
-    case "${type}" in \
-        ext*) \
-            ext2simg "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" \
-                     "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sparse" \
-            ;; \
-        *) \
-            img2simg "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" \
-                     "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sparse" \
-            ;; \
-    esac \
+    img2simg "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" \
+             "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sparse" \
Quoted 8 lines
Quoted 8 lines
meta-oe/classes/image_types_sparse.bbclass +0 -1
 "
 CONVERSION_DEPENDS_sparse = "android-tools-native"
--

2.30.2

--
With best wishes
Dmitry

Signature · 2 lines
With best wishes
Dmitry
#5 lore raw
In reply to Khem Raj

пт, 20 авг. 2021 г. в 21:03, Khem Raj <[email protected]>:

Quoted 17 lines · Dmitry Baryshkov
Quoted 13 lines

ср, 18 авг. 2021 г. в 21:23, Khem Raj <[email protected]>:

Quoted 10 lines · Dmitry Baryshkov
Quoted 6 lines

Under some conditions ext2simg can corrupt the file system (see
https://lore.kernel.org/linux-ext4/CAP71WjwVdqmLEq1NGWK36JkEd-i05YcAu4jeY6GFjsk6TS=Mtg@mail.gmail.com/).
This has been reproduced with the ext2simg currently found meta-oe's android-tools-native). Stop using ext2simg and always use img2simg. This results in bigger images, but without the risk of image corruption.

how big are the images ?

Quoted 7 lines
Quoted 4 lines

Just checked. I've 1GB (964 MB) ext4 image. gzipped it takes 227 MB. Given that I got:
ext2simg - 518MB
img2simg - 655 MB

Hmm so Choice is corrupted at times and small or big but not corrupted I guess we should take the second option as it seems more stable

Gracious ping.

Quoted 44 lines
Quoted 44 lines
Quoted 30 lines
Quoted 30 lines
---
 meta-oe/classes/image_types_sparse.bbclass | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)
meta-oe/classes/image_types_sparse.bbclass +2 -10
index 65d980fd913f..4263593a8dd1 100644
@@ -2,15 +2,7 @@ inherit image_types
 
 CONVERSIONTYPES += "sparse"
 CONVERSION_CMD:sparse = " \
-    case "${type}" in \
-        ext*) \
-            ext2simg "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" \
-                     "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sparse" \
-            ;; \
-        *) \
-            img2simg "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" \
-                     "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sparse" \
-            ;; \
-    esac \
+    img2simg "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" \
+             "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sparse" \
Quoted 8 lines
Quoted 8 lines
meta-oe/classes/image_types_sparse.bbclass +0 -1
 "
 CONVERSION_DEPENDS_sparse = "android-tools-native"
--

2.30.2

--
With best wishes
Dmitry

Signature · 2 lines
With best wishes
Dmitry
#6 lore raw
Quoted 24 lines · Dmitry Baryshkov

пт, 20 авг. 2021 г. в 21:03, Khem Raj <[email protected]>:

Quoted 23 lines · Dmitry Baryshkov
Quoted 17 lines

ср, 18 авг. 2021 г. в 21:23, Khem Raj <[email protected]>:

Quoted 10 lines · Dmitry Baryshkov
Quoted 6 lines

Under some conditions ext2simg can corrupt the file system (see
https://lore.kernel.org/linux-ext4/CAP71WjwVdqmLEq1NGWK36JkEd-i05YcAu4jeY6GFjsk6TS=Mtg@mail.gmail.com/).
This has been reproduced with the ext2simg currently found meta-oe's android-tools-native). Stop using ext2simg and always use img2simg. This results in bigger images, but without the risk of image corruption.

how big are the images ?

Just checked. I've 1GB (964 MB) ext4 image. gzipped it takes 227 MB. Given that I got:
ext2simg - 518MB
img2simg - 655 MB

Quoted 4 lines
Quoted 1 line

Hmm so Choice is corrupted at times and small or big but not corrupted I guess we should take the second option as it seems more stable

Gracious ping.

thanks for reminder, it fell through cracks. I have it in master-next now.

Quoted 47 lines
Quoted 44 lines
Quoted 44 lines
Quoted 30 lines
Quoted 30 lines
---
  meta-oe/classes/image_types_sparse.bbclass | 12 ++----------
  1 file changed, 2 insertions(+), 10 deletions(-)
meta-oe/classes/image_types_sparse.bbclass +2 -10
index 65d980fd913f..4263593a8dd1 100644
@@ -2,15 +2,7 @@ inherit image_types
 
  CONVERSIONTYPES += "sparse"
  CONVERSION_CMD:sparse = " \
-    case "${type}" in \
-        ext*) \
-            ext2simg "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" \
-                     "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sparse" \
-            ;; \
-        *) \
-            img2simg "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" \
-                     "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sparse" \
-            ;; \
-    esac \
+    img2simg "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" \
+             "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sparse" \
Quoted 8 lines
Quoted 8 lines
meta-oe/classes/image_types_sparse.bbclass +0 -1
  "
  CONVERSION_DEPENDS_sparse = "android-tools-native"
--

2.30.2

--
With best wishes
Dmitry

#7 lore raw

пн, 30 авг. 2021 г. в 23:45, Khem Raj <[email protected]>:

Quoted 28 lines · Dmitry Baryshkov
Quoted 24 lines

пт, 20 авг. 2021 г. в 21:03, Khem Raj <[email protected]>:

Quoted 23 lines · Dmitry Baryshkov
Quoted 17 lines

ср, 18 авг. 2021 г. в 21:23, Khem Raj <[email protected]>:

Quoted 10 lines · Dmitry Baryshkov
Quoted 6 lines

Under some conditions ext2simg can corrupt the file system (see
https://lore.kernel.org/linux-ext4/CAP71WjwVdqmLEq1NGWK36JkEd-i05YcAu4jeY6GFjsk6TS=Mtg@mail.gmail.com/).
This has been reproduced with the ext2simg currently found meta-oe's android-tools-native). Stop using ext2simg and always use img2simg. This results in bigger images, but without the risk of image corruption.

how big are the images ?

Just checked. I've 1GB (964 MB) ext4 image. gzipped it takes 227 MB. Given that I got:
ext2simg - 518MB
img2simg - 655 MB

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Hmm so Choice is corrupted at times and small or big but not corrupted I guess we should take the second option as it seems more stable

Gracious ping.

thanks for reminder, it fell through cracks. I have it in master-next now.

Thank you!

Quoted 48 lines
Quoted 48 lines
Quoted 45 lines
Quoted 45 lines
Quoted 31 lines
Quoted 31 lines
---
  meta-oe/classes/image_types_sparse.bbclass | 12 ++----------
  1 file changed, 2 insertions(+), 10 deletions(-)
meta-oe/classes/image_types_sparse.bbclass +2 -10
index 65d980fd913f..4263593a8dd1 100644
@@ -2,15 +2,7 @@ inherit image_types
 
  CONVERSIONTYPES += "sparse"
  CONVERSION_CMD:sparse = " \
-    case "${type}" in \
-        ext*) \
-            ext2simg "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" \
-                     "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sparse" \
-            ;; \
-        *) \
-            img2simg "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" \
-                     "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sparse" \
-            ;; \
-    esac \
+    img2simg "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}" \
+             "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.sparse" \
Quoted 8 lines
Quoted 8 lines
meta-oe/classes/image_types_sparse.bbclass +0 -1
  "
  CONVERSION_DEPENDS_sparse = "android-tools-native"
--

2.30.2

--
With best wishes
Dmitry

Signature · 2 lines
With best wishes
Dmitry