[bug report] xfs: support creating per-RTG files in growfs

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

 



Hello Christoph Hellwig,

Commit ae897e0bed0f ("xfs: support creating per-RTG files in growfs")
from Nov 3, 2024 (linux-next), leads to the following Smatch static
checker warning:

fs/xfs/libxfs/xfs_rtgroup.c:499 xfs_rtginode_create() warn: missing unwind goto?

fs/xfs/libxfs/xfs_rtgroup.c
    467 int
    468 xfs_rtginode_create(
    469         struct xfs_rtgroup                *rtg,
    470         enum xfs_rtg_inodes                type,
    471         bool                                init)
    472 {
    473         const struct xfs_rtginode_ops        *ops = &xfs_rtginode_ops[type];
    474         struct xfs_mount                *mp = rtg_mount(rtg);
    475         struct xfs_metadir_update        upd = {
    476                 .dp                        = mp->m_rtdirip,
    477                 .metafile_type                = ops->metafile_type,
    478         };
    479         int                                error;
    480 
    481         if (!xfs_rtginode_enabled(rtg, type))
    482                 return 0;
    483 
    484         if (!mp->m_rtdirip) {
    485                 xfs_fs_mark_sick(mp, XFS_SICK_FS_METADIR);
    486                 return -EFSCORRUPTED;
    487         }
    488 
    489         upd.path = xfs_rtginode_path(rtg_rgno(rtg), type);
    490         if (!upd.path)
    491                 return -ENOMEM;
    492 
    493         error = xfs_metadir_start_create(&upd);
    494         if (error)
    495                 goto out_path;
    496 
    497         error = xfs_metadir_create(&upd, S_IFREG);
    498         if (error)
--> 499                 return error;

I think this should go to out_cancel?  I'm not totally sure.

    500 
    501         xfs_rtginode_lockdep_setup(upd.ip, rtg_rgno(rtg), type);
    502 
    503         upd.ip->i_projid = rtg_rgno(rtg);
    504         error = ops->create(rtg, upd.ip, upd.tp, init);
    505         if (error)
    506                 goto out_cancel;
    507 
    508         error = xfs_metadir_commit(&upd);
    509         if (error)
    510                 goto out_path;
    511 
    512         kfree(upd.path);
    513         xfs_finish_inode_setup(upd.ip);
    514         rtg->rtg_inodes[type] = upd.ip;
    515         return 0;
    516 
    517 out_cancel:
    518         xfs_metadir_cancel(&upd, error);
    519         /* Have to finish setting up the inode to ensure it's deleted. */
    520         if (upd.ip) {
    521                 xfs_finish_inode_setup(upd.ip);
    522                 xfs_irele(upd.ip);
    523         }
    524 out_path:
    525         kfree(upd.path);
    526         return error;
    527 }

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