[linux-next:master 10764/10966] fs/ext4/move_extent.c:247:1: warning: stack frame size of 2256 bytes in function 'move_extent_per_page'

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

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   2996bd3f6ca9ea529b40c369a94b247657abdb4d
commit: dc25526e4b3cd508654af38934a2cd318b3a8d4e [10764/10966] ubsan: move cc-option tests into Kconfig
config: mips-randconfig-r015-20201207 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project a2f922140f5380571fb74179f2bf622b3b925697)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install mips cross compiling tool for clang build
        # apt-get install binutils-mips-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=dc25526e4b3cd508654af38934a2cd318b3a8d4e
        git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
        git fetch --no-tags linux-next master
        git checkout dc25526e4b3cd508654af38934a2cd318b3a8d4e
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips 

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

All warnings (new ones prefixed by >>):

>> fs/ext4/move_extent.c:247:1: warning: stack frame size of 2256 bytes in function 'move_extent_per_page' [-Wframe-larger-than=]
   move_extent_per_page(struct file *o_filp, struct inode *donor_inode,
   ^
   1 warning generated.

vim +/move_extent_per_page +247 fs/ext4/move_extent.c

bb5574880574fe Dmitry Monakhov    2012-09-26  228  
748de6736c1e48 Akira Fujita       2009-06-17  229  /**
748de6736c1e48 Akira Fujita       2009-06-17  230   * move_extent_per_page - Move extent data per page
748de6736c1e48 Akira Fujita       2009-06-17  231   *
748de6736c1e48 Akira Fujita       2009-06-17  232   * @o_filp:			file structure of original file
748de6736c1e48 Akira Fujita       2009-06-17  233   * @donor_inode:		donor inode
748de6736c1e48 Akira Fujita       2009-06-17  234   * @orig_page_offset:		page index on original file
65dd8327eb055a Xiaoguang Wang     2014-10-11  235   * @donor_page_offset:		page index on donor file
748de6736c1e48 Akira Fujita       2009-06-17  236   * @data_offset_in_page:	block index where data swapping starts
748de6736c1e48 Akira Fujita       2009-06-17  237   * @block_len_in_page:		the number of blocks to be swapped
556615dcbf38b0 Lukas Czerner      2014-04-20  238   * @unwritten:			orig extent is unwritten or not
f868a48d06f888 Akira Fujita       2009-11-23  239   * @err:			pointer to save return value
748de6736c1e48 Akira Fujita       2009-06-17  240   *
748de6736c1e48 Akira Fujita       2009-06-17  241   * Save the data in original inode blocks and replace original inode extents
65dd8327eb055a Xiaoguang Wang     2014-10-11  242   * with donor inode extents by calling ext4_swap_extents().
f868a48d06f888 Akira Fujita       2009-11-23  243   * Finally, write out the saved data in new original inode blocks. Return
f868a48d06f888 Akira Fujita       2009-11-23  244   * replaced block count.
748de6736c1e48 Akira Fujita       2009-06-17  245   */
748de6736c1e48 Akira Fujita       2009-06-17  246  static int
44fc48f7048ab9 Akira Fujita       2009-09-05 @247  move_extent_per_page(struct file *o_filp, struct inode *donor_inode,
fcf6b1b729bcd2 Dmitry Monakhov    2014-08-30  248  		     pgoff_t orig_page_offset, pgoff_t donor_page_offset,
fcf6b1b729bcd2 Dmitry Monakhov    2014-08-30  249  		     int data_offset_in_page,
556615dcbf38b0 Lukas Czerner      2014-04-20  250  		     int block_len_in_page, int unwritten, int *err)
748de6736c1e48 Akira Fujita       2009-06-17  251  {
496ad9aa8ef448 Al Viro            2013-01-23  252  	struct inode *orig_inode = file_inode(o_filp);
bb5574880574fe Dmitry Monakhov    2012-09-26  253  	struct page *pagep[2] = {NULL, NULL};
748de6736c1e48 Akira Fujita       2009-06-17  254  	handle_t *handle;
fcf6b1b729bcd2 Dmitry Monakhov    2014-08-30  255  	ext4_lblk_t orig_blk_offset, donor_blk_offset;
748de6736c1e48 Akira Fujita       2009-06-17  256  	unsigned long blocksize = orig_inode->i_sb->s_blocksize;
f868a48d06f888 Akira Fujita       2009-11-23  257  	unsigned int tmp_data_size, data_size, replaced_size;
bcff24887d00bc Eryu Guan          2016-02-12  258  	int i, err2, jblocks, retries = 0;
f868a48d06f888 Akira Fujita       2009-11-23  259  	int replaced_count = 0;
bb5574880574fe Dmitry Monakhov    2012-09-26  260  	int from = data_offset_in_page << orig_inode->i_blkbits;
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01  261  	int blocks_per_page = PAGE_SIZE >> orig_inode->i_blkbits;
88c6b61ff1cfb4 Dmitry Monakhov    2014-11-05  262  	struct super_block *sb = orig_inode->i_sb;
bcff24887d00bc Eryu Guan          2016-02-12  263  	struct buffer_head *bh = NULL;
748de6736c1e48 Akira Fujita       2009-06-17  264  
748de6736c1e48 Akira Fujita       2009-06-17  265  	/*
748de6736c1e48 Akira Fujita       2009-06-17  266  	 * It needs twice the amount of ordinary journal buffers because
748de6736c1e48 Akira Fujita       2009-06-17  267  	 * inode and donor_inode may change each different metadata blocks.
748de6736c1e48 Akira Fujita       2009-06-17  268  	 */
bb5574880574fe Dmitry Monakhov    2012-09-26  269  again:
bb5574880574fe Dmitry Monakhov    2012-09-26  270  	*err = 0;
748de6736c1e48 Akira Fujita       2009-06-17  271  	jblocks = ext4_writepage_trans_blocks(orig_inode) * 2;
9924a92a8c2175 Theodore Ts'o      2013-02-08  272  	handle = ext4_journal_start(orig_inode, EXT4_HT_MOVE_EXTENTS, jblocks);
748de6736c1e48 Akira Fujita       2009-06-17  273  	if (IS_ERR(handle)) {
f868a48d06f888 Akira Fujita       2009-11-23  274  		*err = PTR_ERR(handle);
f868a48d06f888 Akira Fujita       2009-11-23  275  		return 0;
748de6736c1e48 Akira Fujita       2009-06-17  276  	}
748de6736c1e48 Akira Fujita       2009-06-17  277  
748de6736c1e48 Akira Fujita       2009-06-17  278  	orig_blk_offset = orig_page_offset * blocks_per_page +
748de6736c1e48 Akira Fujita       2009-06-17  279  		data_offset_in_page;
748de6736c1e48 Akira Fujita       2009-06-17  280  
fcf6b1b729bcd2 Dmitry Monakhov    2014-08-30  281  	donor_blk_offset = donor_page_offset * blocks_per_page +
fcf6b1b729bcd2 Dmitry Monakhov    2014-08-30  282  		data_offset_in_page;
fcf6b1b729bcd2 Dmitry Monakhov    2014-08-30  283  
f868a48d06f888 Akira Fujita       2009-11-23  284  	/* Calculate data_size */
748de6736c1e48 Akira Fujita       2009-06-17  285  	if ((orig_blk_offset + block_len_in_page - 1) ==
748de6736c1e48 Akira Fujita       2009-06-17  286  	    ((orig_inode->i_size - 1) >> orig_inode->i_blkbits)) {
748de6736c1e48 Akira Fujita       2009-06-17  287  		/* Replace the last block */
f868a48d06f888 Akira Fujita       2009-11-23  288  		tmp_data_size = orig_inode->i_size & (blocksize - 1);
748de6736c1e48 Akira Fujita       2009-06-17  289  		/*
f868a48d06f888 Akira Fujita       2009-11-23  290  		 * If data_size equal zero, it shows data_size is multiples of
748de6736c1e48 Akira Fujita       2009-06-17  291  		 * blocksize. So we set appropriate value.
748de6736c1e48 Akira Fujita       2009-06-17  292  		 */
f868a48d06f888 Akira Fujita       2009-11-23  293  		if (tmp_data_size == 0)
f868a48d06f888 Akira Fujita       2009-11-23  294  			tmp_data_size = blocksize;
748de6736c1e48 Akira Fujita       2009-06-17  295  
f868a48d06f888 Akira Fujita       2009-11-23  296  		data_size = tmp_data_size +
748de6736c1e48 Akira Fujita       2009-06-17  297  			((block_len_in_page - 1) << orig_inode->i_blkbits);
f868a48d06f888 Akira Fujita       2009-11-23  298  	} else
f868a48d06f888 Akira Fujita       2009-11-23  299  		data_size = block_len_in_page << orig_inode->i_blkbits;
f868a48d06f888 Akira Fujita       2009-11-23  300  
f868a48d06f888 Akira Fujita       2009-11-23  301  	replaced_size = data_size;
748de6736c1e48 Akira Fujita       2009-06-17  302  
bb5574880574fe Dmitry Monakhov    2012-09-26  303  	*err = mext_page_double_lock(orig_inode, donor_inode, orig_page_offset,
fcf6b1b729bcd2 Dmitry Monakhov    2014-08-30  304  				     donor_page_offset, pagep);
f868a48d06f888 Akira Fujita       2009-11-23  305  	if (unlikely(*err < 0))
bb5574880574fe Dmitry Monakhov    2012-09-26  306  		goto stop_journal;
8c854473917354 Dmitry Monakhov    2012-09-26  307  	/*
556615dcbf38b0 Lukas Czerner      2014-04-20  308  	 * If orig extent was unwritten it can become initialized
8c854473917354 Dmitry Monakhov    2012-09-26  309  	 * at any time after i_data_sem was dropped, in order to
8c854473917354 Dmitry Monakhov    2012-09-26  310  	 * serialize with delalloc we have recheck extent while we
8c854473917354 Dmitry Monakhov    2012-09-26  311  	 * hold page's lock, if it is still the case data copy is not
8c854473917354 Dmitry Monakhov    2012-09-26  312  	 * necessary, just swap data blocks between orig and donor.
8c854473917354 Dmitry Monakhov    2012-09-26  313  	 */
556615dcbf38b0 Lukas Czerner      2014-04-20  314  	if (unwritten) {
393d1d1d769338 Dr. Tilmann Bubeck 2013-04-08  315  		ext4_double_down_write_data_sem(orig_inode, donor_inode);
8c854473917354 Dmitry Monakhov    2012-09-26  316  		/* If any of extents in range became initialized we have to
8c854473917354 Dmitry Monakhov    2012-09-26  317  		 * fallback to data copying */
556615dcbf38b0 Lukas Czerner      2014-04-20  318  		unwritten = mext_check_coverage(orig_inode, orig_blk_offset,
8c854473917354 Dmitry Monakhov    2012-09-26  319  						block_len_in_page, 1, err);
8c854473917354 Dmitry Monakhov    2012-09-26  320  		if (*err)
8c854473917354 Dmitry Monakhov    2012-09-26  321  			goto drop_data_sem;
8c854473917354 Dmitry Monakhov    2012-09-26  322  
fcf6b1b729bcd2 Dmitry Monakhov    2014-08-30  323  		unwritten &= mext_check_coverage(donor_inode, donor_blk_offset,
8c854473917354 Dmitry Monakhov    2012-09-26  324  						 block_len_in_page, 1, err);
8c854473917354 Dmitry Monakhov    2012-09-26  325  		if (*err)
8c854473917354 Dmitry Monakhov    2012-09-26  326  			goto drop_data_sem;
748de6736c1e48 Akira Fujita       2009-06-17  327  
556615dcbf38b0 Lukas Czerner      2014-04-20  328  		if (!unwritten) {
393d1d1d769338 Dr. Tilmann Bubeck 2013-04-08  329  			ext4_double_up_write_data_sem(orig_inode, donor_inode);
8c854473917354 Dmitry Monakhov    2012-09-26  330  			goto data_copy;
8c854473917354 Dmitry Monakhov    2012-09-26  331  		}
8c854473917354 Dmitry Monakhov    2012-09-26  332  		if ((page_has_private(pagep[0]) &&
8c854473917354 Dmitry Monakhov    2012-09-26  333  		     !try_to_release_page(pagep[0], 0)) ||
8c854473917354 Dmitry Monakhov    2012-09-26  334  		    (page_has_private(pagep[1]) &&
8c854473917354 Dmitry Monakhov    2012-09-26  335  		     !try_to_release_page(pagep[1], 0))) {
8c854473917354 Dmitry Monakhov    2012-09-26  336  			*err = -EBUSY;
8c854473917354 Dmitry Monakhov    2012-09-26  337  			goto drop_data_sem;
8c854473917354 Dmitry Monakhov    2012-09-26  338  		}
fcf6b1b729bcd2 Dmitry Monakhov    2014-08-30  339  		replaced_count = ext4_swap_extents(handle, orig_inode,
8c854473917354 Dmitry Monakhov    2012-09-26  340  						   donor_inode, orig_blk_offset,
fcf6b1b729bcd2 Dmitry Monakhov    2014-08-30  341  						   donor_blk_offset,
fcf6b1b729bcd2 Dmitry Monakhov    2014-08-30  342  						   block_len_in_page, 1, err);
8c854473917354 Dmitry Monakhov    2012-09-26  343  	drop_data_sem:
393d1d1d769338 Dr. Tilmann Bubeck 2013-04-08  344  		ext4_double_up_write_data_sem(orig_inode, donor_inode);
8c854473917354 Dmitry Monakhov    2012-09-26  345  		goto unlock_pages;
8c854473917354 Dmitry Monakhov    2012-09-26  346  	}
8c854473917354 Dmitry Monakhov    2012-09-26  347  data_copy:
bb5574880574fe Dmitry Monakhov    2012-09-26  348  	*err = mext_page_mkuptodate(pagep[0], from, from + replaced_size);
bb5574880574fe Dmitry Monakhov    2012-09-26  349  	if (*err)
bb5574880574fe Dmitry Monakhov    2012-09-26  350  		goto unlock_pages;
748de6736c1e48 Akira Fujita       2009-06-17  351  
bb5574880574fe Dmitry Monakhov    2012-09-26  352  	/* At this point all buffers in range are uptodate, old mapping layout
bb5574880574fe Dmitry Monakhov    2012-09-26  353  	 * is no longer required, try to drop it now. */
bb5574880574fe Dmitry Monakhov    2012-09-26  354  	if ((page_has_private(pagep[0]) && !try_to_release_page(pagep[0], 0)) ||
bb5574880574fe Dmitry Monakhov    2012-09-26  355  	    (page_has_private(pagep[1]) && !try_to_release_page(pagep[1], 0))) {
bb5574880574fe Dmitry Monakhov    2012-09-26  356  		*err = -EBUSY;
bb5574880574fe Dmitry Monakhov    2012-09-26  357  		goto unlock_pages;
bb5574880574fe Dmitry Monakhov    2012-09-26  358  	}
6e2631463f3a2c Dmitry Monakhov    2014-07-27  359  	ext4_double_down_write_data_sem(orig_inode, donor_inode);
fcf6b1b729bcd2 Dmitry Monakhov    2014-08-30  360  	replaced_count = ext4_swap_extents(handle, orig_inode, donor_inode,
fcf6b1b729bcd2 Dmitry Monakhov    2014-08-30  361  					       orig_blk_offset, donor_blk_offset,
fcf6b1b729bcd2 Dmitry Monakhov    2014-08-30  362  					   block_len_in_page, 1, err);
6e2631463f3a2c Dmitry Monakhov    2014-07-27  363  	ext4_double_up_write_data_sem(orig_inode, donor_inode);
bb5574880574fe Dmitry Monakhov    2012-09-26  364  	if (*err) {
f868a48d06f888 Akira Fujita       2009-11-23  365  		if (replaced_count) {
f868a48d06f888 Akira Fujita       2009-11-23  366  			block_len_in_page = replaced_count;
f868a48d06f888 Akira Fujita       2009-11-23  367  			replaced_size =
f868a48d06f888 Akira Fujita       2009-11-23  368  				block_len_in_page << orig_inode->i_blkbits;
ac48b0a1d06888 Akira Fujita       2009-11-24  369  		} else
bb5574880574fe Dmitry Monakhov    2012-09-26  370  			goto unlock_pages;
748de6736c1e48 Akira Fujita       2009-06-17  371  	}
bb5574880574fe Dmitry Monakhov    2012-09-26  372  	/* Perform all necessary steps similar write_begin()/write_end()
bb5574880574fe Dmitry Monakhov    2012-09-26  373  	 * but keeping in mind that i_size will not change */
bcff24887d00bc Eryu Guan          2016-02-12  374  	if (!page_has_buffers(pagep[0]))
bcff24887d00bc Eryu Guan          2016-02-12  375  		create_empty_buffers(pagep[0], 1 << orig_inode->i_blkbits, 0);
bcff24887d00bc Eryu Guan          2016-02-12  376  	bh = page_buffers(pagep[0]);
bcff24887d00bc Eryu Guan          2016-02-12  377  	for (i = 0; i < data_offset_in_page; i++)
bcff24887d00bc Eryu Guan          2016-02-12  378  		bh = bh->b_this_page;
bcff24887d00bc Eryu Guan          2016-02-12  379  	for (i = 0; i < block_len_in_page; i++) {
bcff24887d00bc Eryu Guan          2016-02-12  380  		*err = ext4_get_block(orig_inode, orig_blk_offset + i, bh, 0);
bcff24887d00bc Eryu Guan          2016-02-12  381  		if (*err < 0)
bcff24887d00bc Eryu Guan          2016-02-12  382  			break;
6ffe77bad545f4 Eryu Guan          2016-02-21  383  		bh = bh->b_this_page;
bcff24887d00bc Eryu Guan          2016-02-12  384  	}
bb5574880574fe Dmitry Monakhov    2012-09-26  385  	if (!*err)
bb5574880574fe Dmitry Monakhov    2012-09-26  386  		*err = block_commit_write(pagep[0], from, from + replaced_size);
748de6736c1e48 Akira Fujita       2009-06-17  387  
bb5574880574fe Dmitry Monakhov    2012-09-26  388  	if (unlikely(*err < 0))
bb5574880574fe Dmitry Monakhov    2012-09-26  389  		goto repair_branches;
bb5574880574fe Dmitry Monakhov    2012-09-26  390  
bb5574880574fe Dmitry Monakhov    2012-09-26  391  	/* Even in case of data=writeback it is reasonable to pin
bb5574880574fe Dmitry Monakhov    2012-09-26  392  	 * inode to transaction, to prevent unexpected data loss */
73131fbb003b36 Ross Zwisler       2019-06-20  393  	*err = ext4_jbd2_inode_add_write(handle, orig_inode,
73131fbb003b36 Ross Zwisler       2019-06-20  394  			(loff_t)orig_page_offset << PAGE_SHIFT, replaced_size);
bb5574880574fe Dmitry Monakhov    2012-09-26  395  
bb5574880574fe Dmitry Monakhov    2012-09-26  396  unlock_pages:
bb5574880574fe Dmitry Monakhov    2012-09-26  397  	unlock_page(pagep[0]);
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01  398  	put_page(pagep[0]);
bb5574880574fe Dmitry Monakhov    2012-09-26  399  	unlock_page(pagep[1]);
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01  400  	put_page(pagep[1]);
bb5574880574fe Dmitry Monakhov    2012-09-26  401  stop_journal:
748de6736c1e48 Akira Fujita       2009-06-17  402  	ext4_journal_stop(handle);
88c6b61ff1cfb4 Dmitry Monakhov    2014-11-05  403  	if (*err == -ENOSPC &&
88c6b61ff1cfb4 Dmitry Monakhov    2014-11-05  404  	    ext4_should_retry_alloc(sb, &retries))
88c6b61ff1cfb4 Dmitry Monakhov    2014-11-05  405  		goto again;
bb5574880574fe Dmitry Monakhov    2012-09-26  406  	/* Buffer was busy because probably is pinned to journal transaction,
bb5574880574fe Dmitry Monakhov    2012-09-26  407  	 * force transaction commit may help to free it. */
88c6b61ff1cfb4 Dmitry Monakhov    2014-11-05  408  	if (*err == -EBUSY && retries++ < 4 && EXT4_SB(sb)->s_journal &&
88c6b61ff1cfb4 Dmitry Monakhov    2014-11-05  409  	    jbd2_journal_force_commit_nested(EXT4_SB(sb)->s_journal))
bb5574880574fe Dmitry Monakhov    2012-09-26  410  		goto again;
f868a48d06f888 Akira Fujita       2009-11-23  411  	return replaced_count;
bb5574880574fe Dmitry Monakhov    2012-09-26  412  
bb5574880574fe Dmitry Monakhov    2012-09-26  413  repair_branches:
bb5574880574fe Dmitry Monakhov    2012-09-26  414  	/*
bb5574880574fe Dmitry Monakhov    2012-09-26  415  	 * This should never ever happen!
bb5574880574fe Dmitry Monakhov    2012-09-26  416  	 * Extents are swapped already, but we are not able to copy data.
bb5574880574fe Dmitry Monakhov    2012-09-26  417  	 * Try to swap extents to it's original places
bb5574880574fe Dmitry Monakhov    2012-09-26  418  	 */
393d1d1d769338 Dr. Tilmann Bubeck 2013-04-08  419  	ext4_double_down_write_data_sem(orig_inode, donor_inode);
fcf6b1b729bcd2 Dmitry Monakhov    2014-08-30  420  	replaced_count = ext4_swap_extents(handle, donor_inode, orig_inode,
fcf6b1b729bcd2 Dmitry Monakhov    2014-08-30  421  					       orig_blk_offset, donor_blk_offset,
fcf6b1b729bcd2 Dmitry Monakhov    2014-08-30  422  					   block_len_in_page, 0, &err2);
393d1d1d769338 Dr. Tilmann Bubeck 2013-04-08  423  	ext4_double_up_write_data_sem(orig_inode, donor_inode);
bb5574880574fe Dmitry Monakhov    2012-09-26  424  	if (replaced_count != block_len_in_page) {
54d3adbc29f0c7 Theodore Ts'o      2020-03-28  425  		ext4_error_inode_block(orig_inode, (sector_t)(orig_blk_offset),
54d3adbc29f0c7 Theodore Ts'o      2020-03-28  426  				       EIO, "Unable to copy data block,"
bb5574880574fe Dmitry Monakhov    2012-09-26  427  				       " data will be lost.");
bb5574880574fe Dmitry Monakhov    2012-09-26  428  		*err = -EIO;
bb5574880574fe Dmitry Monakhov    2012-09-26  429  	}
bb5574880574fe Dmitry Monakhov    2012-09-26  430  	replaced_count = 0;
bb5574880574fe Dmitry Monakhov    2012-09-26  431  	goto unlock_pages;
748de6736c1e48 Akira Fujita       2009-06-17  432  }
748de6736c1e48 Akira Fujita       2009-06-17  433  

:::::: The code at line 247 was first introduced by commit
:::::: 44fc48f7048ab9657b524938a832fec4e0acea98 ext4: Fix small typo for move_extent_per_page()

:::::: TO: Akira Fujita <a-fujita@xxxxxxxxxxxxx>
:::::: CC: Theodore Ts'o <tytso@xxxxxxx>

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

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux