From: Gao Xiang <hsiangkao@linux.alibaba.com>
To: David Scott <dave@recoil.org>, linux-erofs@lists.ozlabs.org
Cc: dave.scott@docker.com
Subject: Re: [PATCH] erofs-utils: mkfs: fix CPU spin using --tar=f when stdin is closed
Date: Tue, 3 Mar 2026 09:41:48 +0800 [thread overview]
Message-ID: <946373a7-23c2-4ee9-a92e-fac76ee7e2e4@linux.alibaba.com> (raw)
In-Reply-To: <aaXec59gbj8fIXai@beast>
On 2026/3/3 03:01, David Scott wrote:
> On my Mac I saw a CPU spin which looked like this:
> ```
> Call graph:
> 2192 Thread_132504 DispatchQueue_1: com.apple.main-thread (serial)
> 2192 start (in dyld) + 6992 [0x185bcbda4]
> 2192 main (in mkfs.erofs) + 7916 [0x10253a6d0]
> 2192 tarerofs_parse_tar (in mkfs.erofs) + 5492 [0x102551d48]
> 2187 tarerofs_write_file_data (in mkfs.erofs) + 140 [0x102551fe0]
> + 2187 write (in libsystem_kernel.dylib) + 8 [0x185f47834]
> 4 tarerofs_write_file_data (in mkfs.erofs) + 116 [0x102551fc8]
> + 4 erofs_iostream_read (in mkfs.erofs) + 16,36,... [0x10254fa28,0x10254fa3c,...]
> 1 tarerofs_write_file_data (in mkfs.erofs) + 140 [0x102551fe0]
> ```
>
> The input stream was closed prematurely, so the reads returned 0 (EOF),
> which wasn't considered an error.
>
> Treat return of 0 (EOF) as an error.
>
> Reproduce by:
> ```
> dd if=/dev/zero bs=1024 count=4 2>/dev/null > /tmp/testfile
> COPYFILE_DISABLE=1 tar cf - -C /tmp testfile | head -c 2048 > /tmp/truncated.tar
> ./mkfs/mkfs.erofs --tar=f output.erofs < /tmp/truncated.tar
> ```
> Before the patch this will hang, after it should fail as expected.
>
> (COPYFILE_DISABLE tells mac to avoid putting extra stuff in the tar)
>
> Closes: https://github.com/erofs/erofs-utils/issues/43
> Signed-off-by: David Scott <dave@recoil.org>
LGTM, will apply.
Thanks,
Gao Xiang
prev parent reply other threads:[~2026-03-03 1:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-02 19:01 [PATCH] erofs-utils: mkfs: fix CPU spin using --tar=f when stdin is closed David Scott
2026-03-03 1:41 ` Gao Xiang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=946373a7-23c2-4ee9-a92e-fac76ee7e2e4@linux.alibaba.com \
--to=hsiangkao@linux.alibaba.com \
--cc=dave.scott@docker.com \
--cc=dave@recoil.org \
--cc=linux-erofs@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox