From: Jens Axboe <axboe@kernel.dk>
To: "Luís Henriques" <lhenriques@suse.de>
Cc: fio@vger.kernel.org
Subject: Re: [PATCH] fio: make sure io_u->file isn't NULL before using it
Date: Mon, 11 Oct 2021 09:15:47 -0600 [thread overview]
Message-ID: <e5cc8d8e-e1ba-a97f-b761-c697bdf136b4@kernel.dk> (raw)
In-Reply-To: <YWQ/s44zyPC/ULBi@suse.de>
On 10/11/21 7:44 AM, Luís Henriques wrote:
> On Mon, Oct 11, 2021 at 06:58:52AM -0600, Jens Axboe wrote:
>> On 10/11/21 4:27 AM, Luís Henriques wrote:
>>> While running fstests generic/095 against ext4 on a zram device I started
>>> seeing fio crashing. Fix it by making sure io_u->file isn't NULL before
>>> accessing it.
>>>
>>> Signed-off-by: Luís Henriques <lhenriques@suse.de>
>>> ---
>>> io_u.c | 3 ++-
>>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/io_u.c b/io_u.c
>>> index 5289b5d1d9c6..b8e715d4118c 100644
>>> --- a/io_u.c
>>> +++ b/io_u.c
>>> @@ -2009,7 +2009,8 @@ static void io_completed(struct thread_data *td, struct io_u **io_u_ptr,
>>> io_u->xfer_buf += bytes;
>>> io_u->offset += bytes;
>>> td->ts.short_io_u[io_u->ddir]++;
>>> - if (io_u->offset < io_u->file->real_file_size) {
>>> + if (io_u->file &&
>>> + (io_u->offset < io_u->file->real_file_size)) {
>>> requeue_io_u(td, io_u_ptr);
>>> return;
>>> }
>>
>> This will prevent the crash, but I'm wondering why io_u-> == NULL for this case.
>> It really should be a valid file.
>>
>> Can you let me know exactly how you're reproducing this? Then I'll give it
>> a whirl too.
>
> Sure, here's my recipe for reproducing this bug:
>
> # modprobe zram num_devices=2
> # echo 1G > /sys/block/zram0/disksize
> # echo 1G > /sys/block/zram1/disksize
> # mkfs.ext4 /dev/zram0
> # mkfs.ext4 /dev/zram1
>
> # ./check generic/095
I know you fixed the issue in the test by now, but any chance you can try
this one and see if it correctly reports full residual instead of trying
to requeue and crash?
diff --git a/io_u.c b/io_u.c
index 5289b5d1d9c6..586a4befdce0 100644
--- a/io_u.c
+++ b/io_u.c
@@ -2004,7 +2004,7 @@ static void io_completed(struct thread_data *td, struct io_u **io_u_ptr,
* Make sure we notice short IO from here, and requeue them
* appropriately!
*/
- if (io_u->resid) {
+ if (bytes && io_u->resid) {
io_u->xfer_buflen = io_u->resid;
io_u->xfer_buf += bytes;
io_u->offset += bytes;
--
Jens Axboe
next prev parent reply other threads:[~2021-10-11 15:15 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-01 17:11 generic/095 failing in ext4 and xfs Luis Henriques
2021-10-01 20:07 ` Theodore Ts'o
2021-10-01 20:46 ` Jens Axboe
2021-10-01 21:59 ` Theodore Ts'o
2021-10-02 10:16 ` Luis Henriques
2021-10-02 14:59 ` Jens Axboe
2021-10-04 10:08 ` Luis Henriques
2021-10-04 10:15 ` Luis Henriques
2021-10-04 12:17 ` Luis Henriques
2021-10-04 16:18 ` Theodore Ts'o
2021-10-06 13:39 ` Luis Henriques
2021-10-11 10:27 ` [PATCH] fio: make sure io_u->file isn't NULL before using it Luís Henriques
2021-10-11 12:58 ` Jens Axboe
2021-10-11 13:44 ` Luís Henriques
2021-10-11 15:15 ` Jens Axboe [this message]
2021-10-11 15:45 ` Luís Henriques
2021-10-10 8:31 ` generic/095 failing in ext4 and xfs Zorro Lang
2021-10-11 9:09 ` Luís Henriques
2021-10-11 9:31 ` Ming Lei
2021-10-11 10:16 ` Luís Henriques
2021-10-11 11:13 ` Ming Lei
2021-10-11 13:41 ` Luís Henriques
2021-10-11 12:44 ` Theodore Ts'o
2021-10-11 13:41 ` Luís Henriques
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=e5cc8d8e-e1ba-a97f-b761-c697bdf136b4@kernel.dk \
--to=axboe@kernel.dk \
--cc=fio@vger.kernel.org \
--cc=lhenriques@suse.de \
/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 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.