Re: New kernel warning triggered by blktests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux