[tytso-ext4:test 13/15] fs/ext4/extents.c:4780 ext4_fallocate() warn: inconsistent returns '&inode->i_rwsem'.

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

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git test
head:   e5a9a1fce162be14c6f1ac325faac48b1a7dea9e
commit: 2890e5e0f49e10f3dadc5f7b7ea434e3e77e12a6 [13/15] ext4: move out common parts into ext4_fallocate()
config: i386-randconfig-141-20250214 (https://download.01.org/0day-ci/archive/20250214/202502142300.QWZQEt11-lkp@xxxxxxxxx/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
| Closes: https://lore.kernel.org/r/202502142300.QWZQEt11-lkp@xxxxxxxxx/

smatch warnings:
fs/ext4/extents.c:4780 ext4_fallocate() warn: inconsistent returns '&inode->i_rwsem'.

vim +4780 fs/ext4/extents.c

2fe17c1075836b Christoph Hellwig  2011-01-14  4715  long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
a2df2a63407803 Amit Arora         2007-07-17  4716  {
496ad9aa8ef448 Al Viro            2013-01-23  4717  	struct inode *inode = file_inode(file);
2890e5e0f49e10 Zhang Yi           2024-12-20  4718  	struct address_space *mapping = file->f_mapping;
fd2f764826df54 Zhang Yi           2024-12-20  4719  	int ret;
a2df2a63407803 Amit Arora         2007-07-17  4720  
2058f83a728adf Michael Halcrow    2015-04-12  4721  	/*
2058f83a728adf Michael Halcrow    2015-04-12  4722  	 * Encrypted inodes can't handle collapse range or insert
2058f83a728adf Michael Halcrow    2015-04-12  4723  	 * range since we would need to re-encrypt blocks with a
2058f83a728adf Michael Halcrow    2015-04-12  4724  	 * different IV or XTS tweak (which are based on the logical
2058f83a728adf Michael Halcrow    2015-04-12  4725  	 * block number).
2058f83a728adf Michael Halcrow    2015-04-12  4726  	 */
592ddec7578a33 Chandan Rajendra   2018-12-12  4727  	if (IS_ENCRYPTED(inode) &&
457b1e353c739a Eric Biggers       2019-12-26  4728  	    (mode & (FALLOC_FL_COLLAPSE_RANGE | FALLOC_FL_INSERT_RANGE)))
2058f83a728adf Michael Halcrow    2015-04-12  4729  		return -EOPNOTSUPP;
2058f83a728adf Michael Halcrow    2015-04-12  4730  
a4bb6b64e39abc Allison Henderson  2011-05-25  4731  	/* Return error if mode is not supported */
9eb79482a97152 Namjae Jeon        2014-02-23  4732  	if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE |
331573febb6a22 Namjae Jeon        2015-06-09  4733  		     FALLOC_FL_COLLAPSE_RANGE | FALLOC_FL_ZERO_RANGE |
331573febb6a22 Namjae Jeon        2015-06-09  4734  		     FALLOC_FL_INSERT_RANGE))
a4bb6b64e39abc Allison Henderson  2011-05-25  4735  		return -EOPNOTSUPP;
a4bb6b64e39abc Allison Henderson  2011-05-25  4736  
f87c7a4b084afc Baokun Li          2022-04-28  4737  	inode_lock(inode);
f87c7a4b084afc Baokun Li          2022-04-28  4738  	ret = ext4_convert_inline_data(inode);
f87c7a4b084afc Baokun Li          2022-04-28  4739  	if (ret)
ea3f17efd36b56 Zhang Yi           2024-12-20  4740  		goto out_inode_lock;
f87c7a4b084afc Baokun Li          2022-04-28  4741  
2890e5e0f49e10 Zhang Yi           2024-12-20  4742  	/* Wait all existing dio workers, newcomers will block on i_rwsem */
2890e5e0f49e10 Zhang Yi           2024-12-20  4743  	inode_dio_wait(inode);
2890e5e0f49e10 Zhang Yi           2024-12-20  4744  
2890e5e0f49e10 Zhang Yi           2024-12-20  4745  	ret = file_modified(file);
2890e5e0f49e10 Zhang Yi           2024-12-20  4746  	if (ret)
2890e5e0f49e10 Zhang Yi           2024-12-20  4747  		return ret;

goto out_inode_lock;

2890e5e0f49e10 Zhang Yi           2024-12-20  4748  
2890e5e0f49e10 Zhang Yi           2024-12-20  4749  	if ((mode & FALLOC_FL_MODE_MASK) == FALLOC_FL_ALLOCATE_RANGE) {
2890e5e0f49e10 Zhang Yi           2024-12-20  4750  		ret = ext4_do_fallocate(file, offset, len, mode);
2890e5e0f49e10 Zhang Yi           2024-12-20  4751  		goto out_inode_lock;
2890e5e0f49e10 Zhang Yi           2024-12-20  4752  	}
2890e5e0f49e10 Zhang Yi           2024-12-20  4753  
2890e5e0f49e10 Zhang Yi           2024-12-20  4754  	/*
2890e5e0f49e10 Zhang Yi           2024-12-20  4755  	 * Follow-up operations will drop page cache, hold invalidate lock
2890e5e0f49e10 Zhang Yi           2024-12-20  4756  	 * to prevent page faults from reinstantiating pages we have
2890e5e0f49e10 Zhang Yi           2024-12-20  4757  	 * released from page cache.
2890e5e0f49e10 Zhang Yi           2024-12-20  4758  	 */
2890e5e0f49e10 Zhang Yi           2024-12-20  4759  	filemap_invalidate_lock(mapping);
2890e5e0f49e10 Zhang Yi           2024-12-20  4760  
2890e5e0f49e10 Zhang Yi           2024-12-20  4761  	ret = ext4_break_layouts(inode);
2890e5e0f49e10 Zhang Yi           2024-12-20  4762  	if (ret)
2890e5e0f49e10 Zhang Yi           2024-12-20  4763  		goto out_invalidate_lock;
2890e5e0f49e10 Zhang Yi           2024-12-20  4764  
fd2f764826df54 Zhang Yi           2024-12-20  4765  	if (mode & FALLOC_FL_PUNCH_HOLE)
ad5cd4f4ee4d5f Darrick J. Wong    2022-03-08  4766  		ret = ext4_punch_hole(file, offset, len);
fd2f764826df54 Zhang Yi           2024-12-20  4767  	else if (mode & FALLOC_FL_COLLAPSE_RANGE)
ad5cd4f4ee4d5f Darrick J. Wong    2022-03-08  4768  		ret = ext4_collapse_range(file, offset, len);
fd2f764826df54 Zhang Yi           2024-12-20  4769  	else if (mode & FALLOC_FL_INSERT_RANGE)
ad5cd4f4ee4d5f Darrick J. Wong    2022-03-08  4770  		ret = ext4_insert_range(file, offset, len);
fd2f764826df54 Zhang Yi           2024-12-20  4771  	else if (mode & FALLOC_FL_ZERO_RANGE)
aa75f4d3daaeb1 Harshad Shirwadkar 2020-10-15  4772  		ret = ext4_zero_range(file, offset, len, mode);
fd2f764826df54 Zhang Yi           2024-12-20  4773  	else
2890e5e0f49e10 Zhang Yi           2024-12-20  4774  		ret = -EOPNOTSUPP;
2890e5e0f49e10 Zhang Yi           2024-12-20  4775  
2890e5e0f49e10 Zhang Yi           2024-12-20  4776  out_invalidate_lock:
2890e5e0f49e10 Zhang Yi           2024-12-20  4777  	filemap_invalidate_unlock(mapping);
ea3f17efd36b56 Zhang Yi           2024-12-20  4778  out_inode_lock:
ea3f17efd36b56 Zhang Yi           2024-12-20  4779  	inode_unlock(inode);
0e8b6879f3c234 Lukas Czerner      2014-03-18 @4780  	return ret;
a2df2a63407803 Amit Arora         2007-07-17  4781  }

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki





[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux