Re: New kernel warning triggered by blktests

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

 



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




[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