Re: [PATCH v2] bio: limit bio max size.

From: kernel test robot
Date: Thu Jan 21 2021 - 00:28:25 EST


Hi Changheun,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on block/for-next]
[also build test ERROR on linux/master linus/master v5.11-rc4 next-20210120]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Changheun-Lee/bio-limit-bio-max-size/20210121-092618
base: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-next
config: ia64-randconfig-s032-20210121 (attached as .config)
compiler: ia64-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.3-208-g46a52ca4-dirty
# https://github.com/0day-ci/linux/commit/3b3676565e975655879c64b22c674166d5c7ff1c
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Changheun-Lee/bio-limit-bio-max-size/20210121-092618
git checkout 3b3676565e975655879c64b22c674166d5c7ff1c
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=ia64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All error/warnings (new ones prefixed by >>):

block/bio.c: In function '__bio_try_merge_page':
>> block/bio.c:895:4: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
895 | if (bio->bi_iter.bi_size > bio->bi_max_size - len)
| ^~
block/bio.c:897:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
897 | return false;
| ^~~~~~
block/bio.c: At top level:
>> block/bio.c:904:2: error: expected identifier or '(' before 'return'
904 | return false;
| ^~~~~~
>> block/bio.c:905:1: error: expected identifier or '(' before '}' token
905 | }
| ^
block/bio.c: In function '__bio_try_merge_page':
block/bio.c:903:2: error: control reaches end of non-void function [-Werror=return-type]
903 | }
| ^
cc1: some warnings being treated as errors


vim +904 block/bio.c

^1da177e4c3f4152 fs/bio.c Linus Torvalds 2005-04-16 868
6e68af666f533625 fs/bio.c Mike Christie 2005-11-11 869 /**
0aa69fd32a5f766e block/bio.c Christoph Hellwig 2018-06-01 870 * __bio_try_merge_page - try appending data to an existing bvec.
6e68af666f533625 fs/bio.c Mike Christie 2005-11-11 871 * @bio: destination bio
551879a48f01826f block/bio.c Ming Lei 2019-04-23 872 * @page: start page to add
0aa69fd32a5f766e block/bio.c Christoph Hellwig 2018-06-01 873 * @len: length of the data to add
551879a48f01826f block/bio.c Ming Lei 2019-04-23 874 * @off: offset of the data relative to @page
ff896738be381efa block/bio.c Christoph Hellwig 2019-06-17 875 * @same_page: return if the segment has been merged inside the same page
6e68af666f533625 fs/bio.c Mike Christie 2005-11-11 876 *
0aa69fd32a5f766e block/bio.c Christoph Hellwig 2018-06-01 877 * Try to add the data at @page + @off to the last bvec of @bio. This is a
3cf148891799d465 block/bio.c Randy Dunlap 2020-07-30 878 * useful optimisation for file systems with a block size smaller than the
0aa69fd32a5f766e block/bio.c Christoph Hellwig 2018-06-01 879 * page size.
0aa69fd32a5f766e block/bio.c Christoph Hellwig 2018-06-01 880 *
551879a48f01826f block/bio.c Ming Lei 2019-04-23 881 * Warn if (@len, @off) crosses pages in case that @same_page is true.
551879a48f01826f block/bio.c Ming Lei 2019-04-23 882 *
0aa69fd32a5f766e block/bio.c Christoph Hellwig 2018-06-01 883 * Return %true on success or %false on failure.
6e68af666f533625 fs/bio.c Mike Christie 2005-11-11 884 */
0aa69fd32a5f766e block/bio.c Christoph Hellwig 2018-06-01 885 bool __bio_try_merge_page(struct bio *bio, struct page *page,
ff896738be381efa block/bio.c Christoph Hellwig 2019-06-17 886 unsigned int len, unsigned int off, bool *same_page)
6e68af666f533625 fs/bio.c Mike Christie 2005-11-11 887 {
c66a14d07c136cc3 block/bio.c Kent Overstreet 2013-11-23 888 if (WARN_ON_ONCE(bio_flagged(bio, BIO_CLONED)))
0aa69fd32a5f766e block/bio.c Christoph Hellwig 2018-06-01 889 return false;
762380ad9322951c block/bio.c Jens Axboe 2014-06-05 890
cc90bc68422318eb block/bio.c Andreas Gruenbacher 2019-12-09 891 if (bio->bi_vcnt > 0) {
0aa69fd32a5f766e block/bio.c Christoph Hellwig 2018-06-01 892 struct bio_vec *bv = &bio->bi_io_vec[bio->bi_vcnt - 1];
c66a14d07c136cc3 block/bio.c Kent Overstreet 2013-11-23 893
5919482e222908d4 block/bio.c Ming Lei 2019-03-17 894 if (page_is_mergeable(bv, page, len, off, same_page)) {
3b3676565e975655 block/bio.c Changheun Lee 2021-01-21 @895 if (bio->bi_iter.bi_size > bio->bi_max_size - len)
2cd896a5e86fc326 block/bio.c Ritesh Harjani 2020-09-09 896 *same_page = false;
cc90bc68422318eb block/bio.c Andreas Gruenbacher 2019-12-09 897 return false;
2cd896a5e86fc326 block/bio.c Ritesh Harjani 2020-09-09 898 }
c66a14d07c136cc3 block/bio.c Kent Overstreet 2013-11-23 899 bv->bv_len += len;
0aa69fd32a5f766e block/bio.c Christoph Hellwig 2018-06-01 900 bio->bi_iter.bi_size += len;
0aa69fd32a5f766e block/bio.c Christoph Hellwig 2018-06-01 901 return true;
0aa69fd32a5f766e block/bio.c Christoph Hellwig 2018-06-01 902 }
5919482e222908d4 block/bio.c Ming Lei 2019-03-17 903 }
0aa69fd32a5f766e block/bio.c Christoph Hellwig 2018-06-01 @904 return false;
c66a14d07c136cc3 block/bio.c Kent Overstreet 2013-11-23 @905 }
0aa69fd32a5f766e block/bio.c Christoph Hellwig 2018-06-01 906 EXPORT_SYMBOL_GPL(__bio_try_merge_page);
c66a14d07c136cc3 block/bio.c Kent Overstreet 2013-11-23 907

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip