* [hch-xfs:xfs-zoned 89/98] fs/xfs/xfs_fsops.c:346 xfs_growfs_data() warn: inconsistent returns '&mp->m_growlock'.
@ 2024-11-23 12:29 kernel test robot
0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2024-11-23 12:29 UTC (permalink / raw)
To: oe-kbuild; +Cc: lkp, Dan Carpenter
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: Christoph Hellwig <hch@lst.de>
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
:::::: branch date: 27 hours ago
:::::: commit date: 27 hours ago
config: x86_64-randconfig-161-20241123 (https://download.01.org/0day-ci/archive/20241123/202411232011.Zes6bDSz-lkp@intel.com/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@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202411232011.Zes6bDSz-lkp@intel.com/
smatch warnings:
fs/xfs/xfs_fsops.c:346 xfs_growfs_data() warn: inconsistent returns '&mp->m_growlock'.
vim +346 fs/xfs/xfs_fsops.c
83a7f86e39ff5d Dave Chinner 2018-05-13 292
^1da177e4c3f41 Linus Torvalds 2005-04-16 293 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 294 * protected versions of growfs function acquire and release locks on the mount
^1da177e4c3f41 Linus Torvalds 2005-04-16 295 * point - exported through ioctls: XFS_IOC_FSGROWFSDATA, XFS_IOC_FSGROWFSLOG,
^1da177e4c3f41 Linus Torvalds 2005-04-16 296 * XFS_IOC_FSGROWFSRT
^1da177e4c3f41 Linus Torvalds 2005-04-16 297 */
^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 sandeen@sandeen.net 2008-11-25 304
743bb4650da9e2 sandeen@sandeen.net 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;
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 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 348
:::::: The code at line 346 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2
:::::: TO: Linus Torvalds <torvalds@ppc970.osdl.org>
:::::: CC: Linus Torvalds <torvalds@ppc970.osdl.org>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 2+ messages in thread
* [hch-xfs:xfs-zoned 89/98] fs/xfs/xfs_fsops.c:346 xfs_growfs_data() warn: inconsistent returns '&mp->m_growlock'.
@ 2024-11-30 9:23 Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2024-11-30 9:23 UTC (permalink / raw)
To: oe-kbuild, Christoph Hellwig; +Cc: lkp, oe-kbuild-all
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/202411232011.Zes6bDSz-lkp@intel.com/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@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202411232011.Zes6bDSz-lkp@intel.com/
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 sandeen@sandeen.net 2008-11-25 304
743bb4650da9e2 sandeen@sandeen.net 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 }
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-11-30 9:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-23 12:29 [hch-xfs:xfs-zoned 89/98] fs/xfs/xfs_fsops.c:346 xfs_growfs_data() warn: inconsistent returns '&mp->m_growlock' kernel test robot
-- strict thread matches above, loose matches on Subject: below --
2024-11-30 9:23 Dan Carpenter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.