Hi Jan, I love your patch! Yet something to improve: [auto build test ERROR on ext4/dev] [also build test ERROR on fuse/for-next linus/master v5.12-rc8] [cannot apply to hnaz-linux-mm/master next-20210423] [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/Jan-Kara/fs-Hole-punch-vs-page-cache-filling-races/20210424-013114 base: https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git dev config: m68k-randconfig-m031-20210423 (attached as .config) compiler: m68k-linux-gcc (GCC) 9.3.0 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 # https://github.com/0day-ci/linux/commit/7a9e8e67e7f7d0070294e9f0a3567a3f28985383 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Jan-Kara/fs-Hole-punch-vs-page-cache-filling-races/20210424-013114 git checkout 7a9e8e67e7f7d0070294e9f0a3567a3f28985383 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross W=1 ARCH=m68k If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All errors (new ones prefixed by >>): fs/f2fs/file.c: In function 'f2fs_release_compress_blocks': >> fs/f2fs/file.c:3567:14: error: 'mapping' undeclared (first use in this function) 3567 | down_write(&mapping->invalidate_lock); | ^~~~~~~ fs/f2fs/file.c:3567:14: note: each undeclared identifier is reported only once for each function it appears in vim +/mapping +3567 fs/f2fs/file.c 3515 3516 static int f2fs_release_compress_blocks(struct file *filp, unsigned long arg) 3517 { 3518 struct inode *inode = file_inode(filp); 3519 struct f2fs_sb_info *sbi = F2FS_I_SB(inode); 3520 pgoff_t page_idx = 0, last_idx; 3521 unsigned int released_blocks = 0; 3522 int ret; 3523 int writecount; 3524 3525 if (!f2fs_sb_has_compression(F2FS_I_SB(inode))) 3526 return -EOPNOTSUPP; 3527 3528 if (!f2fs_compressed_file(inode)) 3529 return -EINVAL; 3530 3531 if (f2fs_readonly(sbi->sb)) 3532 return -EROFS; 3533 3534 ret = mnt_want_write_file(filp); 3535 if (ret) 3536 return ret; 3537 3538 f2fs_balance_fs(F2FS_I_SB(inode), true); 3539 3540 inode_lock(inode); 3541 3542 writecount = atomic_read(&inode->i_writecount); 3543 if ((filp->f_mode & FMODE_WRITE && writecount != 1) || 3544 (!(filp->f_mode & FMODE_WRITE) && writecount)) { 3545 ret = -EBUSY; 3546 goto out; 3547 } 3548 3549 if (IS_IMMUTABLE(inode)) { 3550 ret = -EINVAL; 3551 goto out; 3552 } 3553 3554 ret = filemap_write_and_wait_range(inode->i_mapping, 0, LLONG_MAX); 3555 if (ret) 3556 goto out; 3557 3558 F2FS_I(inode)->i_flags |= F2FS_IMMUTABLE_FL; 3559 f2fs_set_inode_flags(inode); 3560 inode->i_ctime = current_time(inode); 3561 f2fs_mark_inode_dirty_sync(inode, true); 3562 3563 if (!atomic_read(&F2FS_I(inode)->i_compr_blocks)) 3564 goto out; 3565 3566 down_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]); > 3567 down_write(&mapping->invalidate_lock); 3568 3569 last_idx = DIV_ROUND_UP(i_size_read(inode), PAGE_SIZE); 3570 3571 while (page_idx < last_idx) { 3572 struct dnode_of_data dn; 3573 pgoff_t end_offset, count; 3574 3575 set_new_dnode(&dn, inode, NULL, NULL, 0); 3576 ret = f2fs_get_dnode_of_data(&dn, page_idx, LOOKUP_NODE); 3577 if (ret) { 3578 if (ret == -ENOENT) { 3579 page_idx = f2fs_get_next_page_offset(&dn, 3580 page_idx); 3581 ret = 0; 3582 continue; 3583 } 3584 break; 3585 } 3586 3587 end_offset = ADDRS_PER_PAGE(dn.node_page, inode); 3588 count = min(end_offset - dn.ofs_in_node, last_idx - page_idx); 3589 count = round_up(count, F2FS_I(inode)->i_cluster_size); 3590 3591 ret = release_compress_blocks(&dn, count); 3592 3593 f2fs_put_dnode(&dn); 3594 3595 if (ret < 0) 3596 break; 3597 3598 page_idx += count; 3599 released_blocks += ret; 3600 } 3601 3602 up_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]); 3603 up_write(&mapping->invalidate_lock); 3604 out: 3605 inode_unlock(inode); 3606 3607 mnt_drop_write_file(filp); 3608 3609 if (ret >= 0) { 3610 ret = put_user(released_blocks, (u64 __user *)arg); 3611 } else if (released_blocks && 3612 atomic_read(&F2FS_I(inode)->i_compr_blocks)) { 3613 set_sbi_flag(sbi, SBI_NEED_FSCK); 3614 f2fs_warn(sbi, "%s: partial blocks were released i_ino=%lx " 3615 "iblocks=%llu, released=%u, compr_blocks=%u, " 3616 "run fsck to fix.", 3617 __func__, inode->i_ino, inode->i_blocks, 3618 released_blocks, 3619 atomic_read(&F2FS_I(inode)->i_compr_blocks)); 3620 } 3621 3622 return ret; 3623 } 3624 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org