tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2.git 
page_mkwrite-off-by-one
head:   63e24dff38ac137273e65ebc7929bcaa4bdcd6fe
commit: 7bac4387870c94f9108bbefbf8a26b3bef455524 [4/7] ext4: Switch to 
page_mkwrite_check_truncate in ext4_page_mkwrite
config: microblaze-randconfig-a001-20200215 (attached as .config)
compiler: microblaze-linux-gcc (GCC) 7.5.0
reproduce:
        wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
        chmod +x ~/bin/make.cross
        git checkout 7bac4387870c94f9108bbefbf8a26b3bef455524
        # save the attached .config to linux build tree
        GCC_VERSION=7.5.0 make.cross ARCH=microblaze 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <[email protected]>

All errors (new ones prefixed by >>):

   fs/buffer.o: In function `block_page_mkwrite':
   fs/buffer.c:2505: undefined reference to `page_mkwrite_check_truncate'
   fs/iomap/buffered-io.o: In function `iomap_page_mkwrite':
   fs/iomap/buffered-io.c:1084: undefined reference to 
`page_mkwrite_check_truncate'
   fs/ext4/inode.o: In function `ext4_page_mkwrite':
>> fs/ext4/inode.c:5939: undefined reference to `page_mkwrite_check_truncate'
   drivers/md/bcache/bset.o: In function `bch_btree_iter_next':
   drivers/md/bcache/bset.c:1155: undefined reference to `_GLOBAL_OFFSET_TABLE_'
   Segmentation fault

vim +5939 fs/ext4/inode.c

  5900  
  5901  vm_fault_t ext4_page_mkwrite(struct vm_fault *vmf)
  5902  {
  5903          struct vm_area_struct *vma = vmf->vma;
  5904          struct page *page = vmf->page;
  5905          unsigned long len;
  5906          int err;
  5907          vm_fault_t ret;
  5908          struct file *file = vma->vm_file;
  5909          struct inode *inode = file_inode(file);
  5910          handle_t *handle;
  5911          get_block_t *get_block;
  5912          int retries = 0;
  5913  
  5914          if (unlikely(IS_IMMUTABLE(inode)))
  5915                  return VM_FAULT_SIGBUS;
  5916  
  5917          sb_start_pagefault(inode->i_sb);
  5918          file_update_time(vma->vm_file);
  5919  
  5920          down_read(&EXT4_I(inode)->i_mmap_sem);
  5921  
  5922          err = ext4_convert_inline_data(inode);
  5923          if (err)
  5924                  goto out_ret;
  5925  
  5926          /* Delalloc case is easy... */
  5927          if (test_opt(inode->i_sb, DELALLOC) &&
  5928              !ext4_should_journal_data(inode) &&
  5929              !ext4_nonda_switch(inode->i_sb)) {
  5930                  do {
  5931                          err = block_page_mkwrite(vma, vmf,
  5932                                                     
ext4_da_get_block_prep);
  5933                  } while (err == -ENOSPC &&
  5934                         ext4_should_retry_alloc(inode->i_sb, &retries));
  5935                  goto out_ret;
  5936          }
  5937  
  5938          lock_page(page);
> 5939          err = page_mkwrite_check_truncate(page, inode);
  5940          if (err < 0) {
  5941                  unlock_page(page);
  5942                  goto out_ret;
  5943          }
  5944          len = err;
  5945  
  5946          /*
  5947           * Return if we have all the buffers mapped. This avoids the 
need to do
  5948           * journal_start/journal_stop which can block and take a long 
time
  5949           */
  5950          if (page_has_buffers(page)) {
  5951                  if (!ext4_walk_page_buffers(NULL, page_buffers(page),
  5952                                              0, len, NULL,
  5953                                              ext4_bh_unmapped)) {
  5954                          /* Wait so that we don't change page under IO */
  5955                          wait_for_stable_page(page);
  5956                          ret = VM_FAULT_LOCKED;
  5957                          goto out;
  5958                  }
  5959          }
  5960          unlock_page(page);
  5961          /* OK, we need to fill the hole... */
  5962          if (ext4_should_dioread_nolock(inode))
  5963                  get_block = ext4_get_block_unwritten;
  5964          else
  5965                  get_block = ext4_get_block;
  5966  retry_alloc:
  5967          handle = ext4_journal_start(inode, EXT4_HT_WRITE_PAGE,
  5968                                      ext4_writepage_trans_blocks(inode));
  5969          if (IS_ERR(handle)) {
  5970                  ret = VM_FAULT_SIGBUS;
  5971                  goto out;
  5972          }
  5973          err = block_page_mkwrite(vma, vmf, get_block);
  5974          if (!err && ext4_should_journal_data(inode)) {
  5975                  if (ext4_walk_page_buffers(handle, page_buffers(page), 
0,
  5976                            PAGE_SIZE, NULL, 
do_journal_get_write_access)) {
  5977                          unlock_page(page);
  5978                          ret = VM_FAULT_SIGBUS;
  5979                          ext4_journal_stop(handle);
  5980                          goto out;
  5981                  }
  5982                  ext4_set_inode_state(inode, EXT4_STATE_JDATA);
  5983          }
  5984          ext4_journal_stop(handle);
  5985          if (err == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, 
&retries))
  5986                  goto retry_alloc;
  5987  out_ret:
  5988          ret = block_page_mkwrite_return(err);
  5989  out:
  5990          up_read(&EXT4_I(inode)->i_mmap_sem);
  5991          sb_end_pagefault(inode->i_sb);
  5992          return ret;
  5993  }
  5994  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

Attachment: .config.gz
Description: application/gzip

Reply via email to