fs/xfs/xfs_fsops.c:346 xfs_growfs_data() warn: inconsistent returns '&mp->m_growlock'.
PATCH 89/98 fs/xfs/xfs_fsops.c:346 xfs_growfs_data() warn: inconsistent returns '&mp->m_growlock'.
tree: git://git.infradead.org/users/hch/xfs xfs-zoned head: 1d218c27f2f5a8c87669b49292f1fd3432112426 commit: a37a349d7a21f1c61dc54c5771a81aee04a265cd [89/98] xfs: don't allow growfs of the data device with internal RT device config: x86_64-randconfig-161-20241123 (https://download.01.org/0day-ci/archive/20241123/[email protected]/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 <[email protected]> | Reported-by: Dan Carpenter <[email protected]> | Closes: https://lore.kernel.org/r/[email protected]/
smatch warnings:fs/xfs/xfs_fsops.c:346 xfs_growfs_data() warn: inconsistent returns '&mp->m_growlock'.
vim +346 fs/xfs/xfs_fsops.c
^1da177e4c3f41 Linus Torvalds 2005-04-16 298 int
^1da177e4c3f41 Linus Torvalds 2005-04-16 299 xfs_growfs_data(
87444b8c267a5c Dave Chinner 2018-05-13 300 struct xfs_mount *mp,
87444b8c267a5c Dave Chinner 2018-05-13 301 struct xfs_growfs_data *in)
^1da177e4c3f41 Linus Torvalds 2005-04-16 302 {
87444b8c267a5c Dave Chinner 2018-05-13 303 int error = 0;
743bb4650da9e2 [email protected] 2008-11-25 304
743bb4650da9e2 [email protected] 2008-11-25 305 if (!capable(CAP_SYS_ADMIN))
2451337dd04390 Dave Chinner 2014-06-25 306 return -EPERM;
cc92e7ac8d9641 Christoph Hellwig 2007-08-30 307 if (!mutex_trylock(&mp->m_growlock))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^2451337dd04390 Dave Chinner 2014-06-25 308 return -EWOULDBLOCK; 87444b8c267a5c Dave Chinner 2018-05-13 309 a37a349d7a21f1 Christoph Hellwig 2024-11-22 310 /* we can't grow the data section when an internal RT section exists */ a37a349d7a21f1 Christoph Hellwig 2024-11-22 311 if (in->newblocks != mp->m_sb.sb_dblocks && mp->m_sb.sb_rtstart) a37a349d7a21f1 Christoph Hellwig 2024-11-22 312 return -EINVAL;
Needs to unlock before returning.
a37a349d7a21f1 Christoph Hellwig 2024-11-22 313
87444b8c267a5c Dave Chinner 2018-05-13 314 /* update imaxpct separately to the physical grow of the filesystem */
87444b8c267a5c Dave Chinner 2018-05-13 315 if (in->imaxpct != mp->m_sb.sb_imax_pct) {
87444b8c267a5c Dave Chinner 2018-05-13 316 error = xfs_growfs_imaxpct(mp, in->imaxpct);
87444b8c267a5c Dave Chinner 2018-05-13 317 if (error)
87444b8c267a5c Dave Chinner 2018-05-13 318 goto out_error;
87444b8c267a5c Dave Chinner 2018-05-13 319 }
87444b8c267a5c Dave Chinner 2018-05-13 320
87444b8c267a5c Dave Chinner 2018-05-13 321 if (in->newblocks != mp->m_sb.sb_dblocks) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 322 error = xfs_growfs_data_private(mp, in);
87444b8c267a5c Dave Chinner 2018-05-13 323 if (error)
87444b8c267a5c Dave Chinner 2018-05-13 324 goto out_error;
87444b8c267a5c Dave Chinner 2018-05-13 325 }
87444b8c267a5c Dave Chinner 2018-05-13 326
87444b8c267a5c Dave Chinner 2018-05-13 327 /* Post growfs calculations needed to reflect new state in operations */
87444b8c267a5c Dave Chinner 2018-05-13 328 if (mp->m_sb.sb_imax_pct) {
87444b8c267a5c Dave Chinner 2018-05-13 329 uint64_t icount = mp->m_sb.sb_dblocks * mp->m_sb.sb_imax_pct;
87444b8c267a5c Dave Chinner 2018-05-13 330 do_div(icount, 100);
ef325959993edd Darrick J. Wong 2019-06-05 331 M_IGEO(mp)->maxicount = XFS_FSB_TO_INO(mp, icount);
87444b8c267a5c Dave Chinner 2018-05-13 332 } else
ef325959993edd Darrick J. Wong 2019-06-05 333 M_IGEO(mp)->maxicount = 0;
87444b8c267a5c Dave Chinner 2018-05-13 334
83a7f86e39ff5d Dave Chinner 2018-05-13 335 /* Update secondary superblocks now the physical grow has completed */
b16817b66b6c97 Dave Chinner 2018-05-13 336 error = xfs_update_secondary_sbs(mp);
83a7f86e39ff5d Dave Chinner 2018-05-13 337
87444b8c267a5c Dave Chinner 2018-05-13 338 out_error:
527851124d10f9 Christoph Hellwig 2015-02-16 339 /*
527851124d10f9 Christoph Hellwig 2015-02-16 340 * Increment the generation unconditionally, the error could be from
527851124d10f9 Christoph Hellwig 2015-02-16 341 * updating the secondary superblocks, in which case the new size
527851124d10f9 Christoph Hellwig 2015-02-16 342 * is live already.
527851124d10f9 Christoph Hellwig 2015-02-16 343 */
527851124d10f9 Christoph Hellwig 2015-02-16 344 mp->m_generation++;
cc92e7ac8d9641 Christoph Hellwig 2007-08-30 345 mutex_unlock(&mp->m_growlock);
^1da177e4c3f41 Linus Torvalds 2005-04-16 @346 return error;
^1da177e4c3f41 Linus Torvalds 2005-04-16 347 }Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki