[bug report] xfs: allow internal RT devices for zoned mode

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

 



Hello Christoph Hellwig,

Commit bdc03eb5f98f ("xfs: allow internal RT devices for zoned mode")
from Nov 17, 2024 (linux-next), leads to the following Smatch static
checker warning:

	fs/xfs/xfs_fsops.c:347 xfs_growfs_data()
	warn: inconsistent returns '&mp->m_growlock'.

fs/xfs/xfs_fsops.c
    299 int
    300 xfs_growfs_data(
    301         struct xfs_mount        *mp,
    302         struct xfs_growfs_data        *in)
    303 {
    304         int                        error = 0;
    305 
    306         if (!capable(CAP_SYS_ADMIN))
    307                 return -EPERM;
    308         if (!mutex_trylock(&mp->m_growlock))
    309                 return -EWOULDBLOCK;
    310 
    311         /* we can't grow the data section when an internal RT section exists */
    312         if (in->newblocks != mp->m_sb.sb_dblocks && mp->m_sb.sb_rtstart)
    313                 return -EINVAL;

goto out_error?

    314 
    315         /* update imaxpct separately to the physical grow of the filesystem */
    316         if (in->imaxpct != mp->m_sb.sb_imax_pct) {
    317                 error = xfs_growfs_imaxpct(mp, in->imaxpct);
    318                 if (error)
    319                         goto out_error;
    320         }
    321 
    322         if (in->newblocks != mp->m_sb.sb_dblocks) {
    323                 error = xfs_growfs_data_private(mp, in);
    324                 if (error)
    325                         goto out_error;
    326         }
    327 
    328         /* Post growfs calculations needed to reflect new state in operations */
    329         if (mp->m_sb.sb_imax_pct) {
    330                 uint64_t icount = mp->m_sb.sb_dblocks * mp->m_sb.sb_imax_pct;
    331                 do_div(icount, 100);
    332                 M_IGEO(mp)->maxicount = XFS_FSB_TO_INO(mp, icount);
    333         } else
    334                 M_IGEO(mp)->maxicount = 0;
    335 
    336         /* Update secondary superblocks now the physical grow has completed */
    337         error = xfs_update_secondary_sbs(mp);
    338 
    339 out_error:
    340         /*
    341          * Increment the generation unconditionally, the error could be from
    342          * updating the secondary superblocks, in which case the new size
    343          * is live already.
    344          */
    345         mp->m_generation++;
    346         mutex_unlock(&mp->m_growlock);
--> 347         return error;
    348 }

regards,
dan carpenter




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux