All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Jens Axboe <axboe@kernel.dk>, 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 19:39:54 -0700	[thread overview]
Message-ID: <5807356b-c11f-b1af-f1dc-280a377f85f9@acm.org> (raw)
In-Reply-To: <609bffeb-ab57-35d3-5f75-3c9e37741829@kernel.dk>

On 4/23/21 2:43 PM, Jens Axboe wrote:
> 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;

Hi Jens,

Thank you for having taken a look. If I apply the following debug patch:

--- a/block/bio.c
+++ b/block/bio.c
@@ -1031,8 +1031,13 @@ static int __bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
 			if (same_page)
 				put_page(page);
 		} else {
-			if (WARN_ON_ONCE(bio_full(bio, len)))
+			if (WARN_ON_ONCE(bio_full(bio, len))) {
+				pr_info("bi_vcnt %u/%u; bi_size %u/%u; len %u\n",
+					bio->bi_vcnt, bio->bi_max_vecs,
+					bio->bi_iter.bi_size, bio_max_size(bio),
+					len);
                                 return -EINVAL;
+			}
 			__bio_add_page(bio, page, len, offset);
 		}
 		offset = 0;

then the following output appears:

	bi_vcnt 12/256; bi_size 126976/130560; len 4096

so I don't think that the above patch would help.

What is remarkable is that test srp/001 does not submit any I/O towards the
block device associated with the SRP initiator (other than a partition table
read). I think this that the following command from tests/srp/rc triggers
the kernel warning:

		dd if=/dev/zero of="${r}" bs=1M count=$((ramdisk_size>>20)) "${oflag[@]}" >/dev/null 2>&1 || return $?

That dd command writes to a null_blk instance. After having added another
debug print statement, the following appeared in the kernel log:

Apr 23 19:08:04 ubuntu-vm kernel: null_blk: module loaded
Apr 23 19:08:04 ubuntu-vm kernel: blk_queue_max_hw_sectors: max_hw_sectors = 255; max_sectors = 255; bio_max_bytes = 130560
Apr 23 19:08:04 ubuntu-vm kernel: blk_queue_max_hw_sectors: max_hw_sectors = 255; max_sectors = 255; bio_max_bytes = 130560

That's the same 130560 byte limit as in the previous print statement.

Bart.

      reply	other threads:[~2021-04-24  2:40 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
2021-04-24  2:39   ` Bart Van Assche [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=5807356b-c11f-b1af-f1dc-280a377f85f9@acm.org \
    --to=bvanassche@acm.org \
    --cc=axboe@kernel.dk \
    --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.