All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Bart Van Assche <bvanassche@acm.org>,
	Changheun Lee <nanich.lee@samsung.com>
Cc: "linux-block@vger.kernel.org" <linux-block@vger.kernel.org>
Subject: Re: New kernel warning triggered by blktests
Date: Fri, 23 Apr 2021 15:43:55 -0600	[thread overview]
Message-ID: <609bffeb-ab57-35d3-5f75-3c9e37741829@kernel.dk> (raw)
In-Reply-To: <45925919-ea46-1e38-2983-87b12c12003a@acm.org>

On 4/23/21 2:38 PM, Bart Van Assche wrote:
> Hi Changheun,
> 
> If I run blktest srp/001 then a kernel warning appears that I haven't
> seen before. I think this is a side-effect of the patch that limits the
> bio size. Please take a look.
> 
> Thanks,
> 
> Bart.
> 
> WARNING: CPU: 1 PID: 15449 at block/bio.c:1034
> __bio_iov_iter_get_pages+0x324/0x350
> Call Trace:
>  bio_iov_iter_get_pages+0x6c/0x360
>  __blkdev_direct_IO_simple+0x291/0x580
>  blkdev_direct_IO+0xb5/0xc0
>  generic_file_direct_write+0x10d/0x290
>  __generic_file_write_iter+0x120/0x290
>  blkdev_write_iter+0x16e/0x280
>  new_sync_write+0x268/0x380
>  vfs_write+0x3e0/0x4f0
>  ksys_write+0xd9/0x180
>  __x64_sys_write+0x43/0x50
>  do_syscall_64+0x32/0x80
>  entry_SYSCALL_64_after_hwframe+0x44/0xae

I wonder if this is a case of violating "must always be able to add a page"?
Bart, does the below change anything?


diff --git a/include/linux/bio.h b/include/linux/bio.h
index f1a99f0a240c..c6428c9f9bf7 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -121,7 +121,8 @@ static inline bool bio_full(struct bio *bio, unsigned len)
 	if (bio->bi_vcnt >= bio->bi_max_vecs)
 		return true;
 
-	if (bio->bi_iter.bi_size > bio_max_size(bio) - len)
+	if (bio->bi_iter.bi_size &&
+	    bio->bi_iter.bi_size > bio_max_size(bio) - len)
 		return true;
 
 	return false;

-- 
Jens Axboe


  reply	other threads:[~2021-04-23 21:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-23 20:38 New kernel warning triggered by blktests Bart Van Assche
2021-04-23 21:43 ` Jens Axboe [this message]
2021-04-24  2:39   ` Bart Van Assche

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=609bffeb-ab57-35d3-5f75-3c9e37741829@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=linux-block@vger.kernel.org \
    --cc=nanich.lee@samsung.com \
    /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.