All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* Re: [OE-core] [PATCH] e2fsprogs: fix mkfs.ext4 not parse hardlink if file has a large inode number
       [not found] <16237D0C4E6E651D.16385@lists.openembedded.org>
@ 2020-07-21  1:55 ` hongxu
  0 siblings, 0 replies; only message in thread
From: hongxu @ 2020-07-21  1:55 UTC (permalink / raw
  To: openembedded-core, richard.purdie

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

Please ignore this, V2 incoming

//Hongxu

On 7/20/20 10:42 PM, hongxu wrote:
> While file has a large inode number, mkfs.ext4 could not parse
> hardlink.
>
> $ ls -il rootfs_ota/a rootfs_ota/boot/b rootfs_ota/boot/c
> 11026675846 -rw-r--r-- 3 hjia users 0 Jul 20 17:44 rootfs_ota/a
> 11026675846 -rw-r--r-- 3 hjia users 0 Jul 20 17:44 rootfs_ota/boot/b
> 11026675846 -rw-r--r-- 3 hjia users 0 Jul 20 17:44 rootfs_ota/boot/c
>
> $ truncate -s 1M rootfs_ota.ext4
>
> $ mkfs.ext4 -F -i 8192 rootfs_ota.ext4 -L otaroot -U fd5f8768-c779-4dc9-adde-165a3d863349 -d rootfs_ota
>
> $ mkdir mnt && sudo mount rootfs_ota.ext4 mnt
>
> $ ls -il mnt/rootfs_ota/a mnt/rootfs_ota/boot/b
> 12 -rw-r--r-- 1 hjia users 0 Jul 20 17:44 mnt/a
> 14 -rw-r--r-- 1 hjia users 0 Jul 20 17:44 mnt/boot/b
> 15 -rw-r--r-- 1 hjia users 0 Jul 20 17:44 mnt/boot/c
>
> After applying this fix
> $ ls -il mnt/rootfs_ota/a mnt/rootfs_ota/boot/b
> 12 -rw-r--r-- 3 hjia users 0 Jul 20 17:44 mnt/a
> 12 -rw-r--r-- 3 hjia users 0 Jul 20 17:44 mnt/boot/b
> 12 -rw-r--r-- 3 hjia users 0 Jul 20 17:44 mnt/boot/c
>
> Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
> ---
>   ...-up-check-for-hardlinks-not-accurate.patch | 54 +++++++++++++++++++
>   .../e2fsprogs/e2fsprogs_1.45.6.bb             |  1 +
>   2 files changed, 55 insertions(+)
>   create mode 100644 meta/recipes-devtools/e2fsprogs/e2fsprogs/0001-fix-up-check-for-hardlinks-not-accurate.patch
>
> diff --git a/meta/recipes-devtools/e2fsprogs/e2fsprogs/0001-fix-up-check-for-hardlinks-not-accurate.patch b/meta/recipes-devtools/e2fsprogs/e2fsprogs/0001-fix-up-check-for-hardlinks-not-accurate.patch
> new file mode 100644
> index 0000000000..0a0687651d
> --- /dev/null
> +++ b/meta/recipes-devtools/e2fsprogs/e2fsprogs/0001-fix-up-check-for-hardlinks-not-accurate.patch
> @@ -0,0 +1,54 @@
> +From c8b243a94a8d2d0a63d353d5d6e91aa6e780e4a2 Mon Sep 17 00:00:00 2001
> +From: Hongxu Jia <hongxu.jia@windriver.com>
> +Date: Mon, 20 Jul 2020 20:53:23 +0800
> +Subject: [PATCH] fix up check for hardlinks not accurate
> +
> +Since commit [382ed4a1 e2fsck: use proper types for variables][1]
> +applied, the input params `ino' of is_hardlink, it used ext2_ino_t
> +instead of ino_t for referencing inode numbers, but it missed to do the
> +same thing on `src_ino' which is used to compare with `ino'.
> +Comparing between different types may cause the hardlinks check is
> +not accurate.
> +
> +[snip misc/create_inode.c]
> +static int is_hardlink(struct hdlinks_s *hdlinks, dev_t dev, ext2_ino_t ino)
> +{
> +    int i;
> +
> +    for (i = 0; i < hdlinks->count; i++) {
> +        if (hdlinks->hdl[i].src_dev == dev &&
> +            hdlinks->hdl[i].src_ino == ino)
> +            return i;
> +    }
> +    return -1;
> +}
> +[snip misc/create_inode.c]
> +
> +Change the type of src_ino to ext2_ino_t, the reason why uses ext2_ino_t
> +instead of ino_t for referencing inode numbers at [2]
> +
> +[1] https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git/commit/?id=382ed4a1c2b60acb9db7631e86dda207bde6076e
> +[2] https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git/commit/?id=31dbecd482405e0d3a67eb58e1a1c8cb9f2ad83e
> +
> +Upstream-Status: Submitted [https://github.com/tytso/e2fsprogs/pull/47]
> +Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
> +---
> + misc/create_inode.h | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/misc/create_inode.h b/misc/create_inode.h
> +index b5eeb420..0561a78a 100644
> +--- a/misc/create_inode.h
> ++++ b/misc/create_inode.h
> +@@ -11,7 +11,7 @@
> + struct hdlink_s
> + {
> + 	dev_t src_dev;
> +-	ino_t src_ino;
> ++	ext2_ino_t src_ino;
> + 	ext2_ino_t dst_ino;
> + };
> +
> +--
> +2.18.2
> +
> diff --git a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.45.6.bb b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.45.6.bb
> index 4ad5b03cac..7b6d2c3b45 100644
> --- a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.45.6.bb
> +++ b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.45.6.bb
> @@ -6,6 +6,7 @@ SRC_URI += "file://remove.ldconfig.call.patch \
>              file://mkdir_p.patch \
>              file://0001-configure.ac-correct-AM_GNU_GETTEXT.patch \
>              file://0001-intl-do-not-try-to-use-gettext-defines-that-no-longe.patch \
> +           file://0001-fix-up-check-for-hardlinks-not-accurate.patch \
>              "
>   
>   SRC_URI_append_class-native = " file://e2fsprogs-fix-missing-check-for-permission-denied.patch \
>
> 



[-- Attachment #2: Type: text/html, Size: 6429 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-07-21  1:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <16237D0C4E6E651D.16385@lists.openembedded.org>
2020-07-21  1:55 ` [OE-core] [PATCH] e2fsprogs: fix mkfs.ext4 not parse hardlink if file has a large inode number hongxu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.