* [djwong-xfs:reserve-rt-metadata-space 153/219] fs/xfs/scrub/repair.c:1819:15: warning: %d in format string (no. 2) requires 'int' but the argument type is 'unsigned int'.
@ 2020-12-21 9:20 kernel test robot
0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2020-12-21 9:20 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 8086 bytes --]
CC: kbuild-all(a)lists.01.org
CC: "Darrick J. Wong" <darrick.wong@oracle.com>
TO: "Darrick J. Wong" <darrick.wong@oracle.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git reserve-rt-metadata-space
head: 207e1ccd65605924e87691251452a581587d26d2
commit: 2abf21a89e265202ca879cbca962109544b3a557 [153/219] xfs: move orphan files to the orphanage
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
"cppcheck warnings: (new ones prefixed by >>)"
>> fs/xfs/scrub/repair.c:1819:15: warning: %d in format string (no. 2) requires 'int' but the argument type is 'unsigned int'. [invalidPrintfArgType_sint]
xname.len = snprintf(fname, sizeof(fname), "%llu.%d",
^
fs/xfs/scrub/repair.c:270:6: warning: Uninitialized variable: freelen [uninitvar]
freelen >= aglen) {
^
vim +1819 fs/xfs/scrub/repair.c
2abf21a89e26520 Darrick J. Wong 2020-11-17 1782
2abf21a89e26520 Darrick J. Wong 2020-11-17 1783 /*
2abf21a89e26520 Darrick J. Wong 2020-11-17 1784 * Move the current file to the orphanage. The caller must not hold any locks
2abf21a89e26520 Darrick J. Wong 2020-11-17 1785 * on the orphanage and must not hold the ILOCK on sc->ip. sc->ip and
2abf21a89e26520 Darrick J. Wong 2020-11-17 1786 * sc->orphanage must not be joined to the transaction. The function returns
2abf21a89e26520 Darrick J. Wong 2020-11-17 1787 * with both inodes joined, ILOCKed, and dirty.
2abf21a89e26520 Darrick J. Wong 2020-11-17 1788 */
2abf21a89e26520 Darrick J. Wong 2020-11-17 1789 int
2abf21a89e26520 Darrick J. Wong 2020-11-17 1790 xrep_move_to_orphanage(
2abf21a89e26520 Darrick J. Wong 2020-11-17 1791 struct xfs_scrub *sc)
2abf21a89e26520 Darrick J. Wong 2020-11-17 1792 {
2abf21a89e26520 Darrick J. Wong 2020-11-17 1793 struct xfs_name xname;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1794 unsigned char fname[MAXNAMELEN + 1];
2abf21a89e26520 Darrick J. Wong 2020-11-17 1795 struct xfs_inode *dp = sc->orphanage;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1796 struct xfs_mount *mp = sc->mp;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1797 xfs_ino_t ino;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1798 unsigned int incr = 0;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1799 unsigned int linkres, dotdotres;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1800 int error;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1801
2abf21a89e26520 Darrick J. Wong 2020-11-17 1802 /* No orphanage? We can't fix this. */
2abf21a89e26520 Darrick J. Wong 2020-11-17 1803 if (!sc->orphanage)
2abf21a89e26520 Darrick J. Wong 2020-11-17 1804 return -EFSCORRUPTED;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1805
2abf21a89e26520 Darrick J. Wong 2020-11-17 1806 /* Try to grab the IOLOCK on the orphanage. */
2abf21a89e26520 Darrick J. Wong 2020-11-17 1807 error = xchk_ilock_inverted(sc->orphanage, XFS_IOLOCK_EXCL);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1808 if (error)
2abf21a89e26520 Darrick J. Wong 2020-11-17 1809 return error;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1810 sc->orphanage_ilock_flags |= XFS_IOLOCK_EXCL;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1811
2abf21a89e26520 Darrick J. Wong 2020-11-17 1812 xname.name = fname;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1813 xname.len = snprintf(fname, sizeof(fname), "%llu", sc->ip->i_ino);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1814 xname.type = xfs_mode_to_ftype(VFS_I(sc->ip)->i_mode);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1815
2abf21a89e26520 Darrick J. Wong 2020-11-17 1816 /* Make sure the filename is unique in the lost+found. */
2abf21a89e26520 Darrick J. Wong 2020-11-17 1817 error = xfs_dir_lookup(sc->tp, dp, &xname, &ino, NULL);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1818 while (error == 0 && incr < 10000) {
2abf21a89e26520 Darrick J. Wong 2020-11-17 @1819 xname.len = snprintf(fname, sizeof(fname), "%llu.%d",
2abf21a89e26520 Darrick J. Wong 2020-11-17 1820 sc->ip->i_ino, ++incr);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1821 error = xfs_dir_lookup(sc->tp, dp, &xname, &ino, NULL);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1822 }
2abf21a89e26520 Darrick J. Wong 2020-11-17 1823 if (error == 0) {
2abf21a89e26520 Darrick J. Wong 2020-11-17 1824 /* We already have 10,000 entries in the orphanage? */
2abf21a89e26520 Darrick J. Wong 2020-11-17 1825 return -EFSCORRUPTED;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1826 }
2abf21a89e26520 Darrick J. Wong 2020-11-17 1827 if (error != -ENOENT)
2abf21a89e26520 Darrick J. Wong 2020-11-17 1828 return error;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1829
2abf21a89e26520 Darrick J. Wong 2020-11-17 1830 trace_xrep_move_orphanage(sc->ip, &xname, dp->i_ino);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1831
2abf21a89e26520 Darrick J. Wong 2020-11-17 1832 /*
2abf21a89e26520 Darrick J. Wong 2020-11-17 1833 * Reserve enough space to add a directory entry to the orphanage and
2abf21a89e26520 Darrick J. Wong 2020-11-17 1834 * update the dotdot entry.
2abf21a89e26520 Darrick J. Wong 2020-11-17 1835 */
2abf21a89e26520 Darrick J. Wong 2020-11-17 1836 linkres = XFS_LINK_SPACE_RES(mp, xname.len);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1837 dotdotres = XFS_RENAME_SPACE_RES(mp, 2);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1838 error = xfs_trans_reserve_more(sc->tp, linkres + dotdotres, 0);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1839 if (error)
2abf21a89e26520 Darrick J. Wong 2020-11-17 1840 return error;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1841
2abf21a89e26520 Darrick J. Wong 2020-11-17 1842 xfs_lock_two_inodes(dp, XFS_ILOCK_EXCL, sc->ip, XFS_ILOCK_EXCL);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1843 sc->ilock_flags |= XFS_ILOCK_EXCL;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1844 sc->orphanage_ilock_flags |= XFS_ILOCK_EXCL;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1845
2abf21a89e26520 Darrick J. Wong 2020-11-17 1846 xfs_trans_ijoin(sc->tp, dp, 0);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1847 xfs_trans_ijoin(sc->tp, sc->ip, 0);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1848
2abf21a89e26520 Darrick J. Wong 2020-11-17 1849 /*
2abf21a89e26520 Darrick J. Wong 2020-11-17 1850 * Create the new name in the orphanage, and bump the link count of
2abf21a89e26520 Darrick J. Wong 2020-11-17 1851 * the orphanage if we just added a directory.
2abf21a89e26520 Darrick J. Wong 2020-11-17 1852 */
2abf21a89e26520 Darrick J. Wong 2020-11-17 1853 error = xfs_dir_createname(sc->tp, dp, &xname, sc->ip->i_ino,
2abf21a89e26520 Darrick J. Wong 2020-11-17 1854 linkres);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1855 if (error)
2abf21a89e26520 Darrick J. Wong 2020-11-17 1856 return error;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1857
2abf21a89e26520 Darrick J. Wong 2020-11-17 1858 xfs_trans_ichgtime(sc->tp, dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1859 if (S_ISDIR(VFS_I(sc->ip)->i_mode))
2abf21a89e26520 Darrick J. Wong 2020-11-17 1860 xfs_bumplink(sc->tp, dp);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1861 xfs_trans_log_inode(sc->tp, dp, XFS_ILOG_CORE);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1862
2abf21a89e26520 Darrick J. Wong 2020-11-17 1863 /* Replace the dotdot entry. */
2abf21a89e26520 Darrick J. Wong 2020-11-17 1864 return xfs_dir_replace(sc->tp, sc->ip, &xfs_name_dotdot, dp->i_ino,
2abf21a89e26520 Darrick J. Wong 2020-11-17 1865 dotdotres);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1866 }
2abf21a89e26520 Darrick J. Wong 2020-11-17 1867
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 4+ messages in thread
* [djwong-xfs:reserve-rt-metadata-space 153/219] fs/xfs/scrub/repair.c:1819:15: warning: %d in format string (no. 2) requires 'int' but the argument type is 'unsigned int'.
@ 2020-12-21 7:35 kernel test robot
0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2020-12-21 7:35 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 8086 bytes --]
CC: kbuild-all(a)lists.01.org
CC: "Darrick J. Wong" <darrick.wong@oracle.com>
TO: "Darrick J. Wong" <darrick.wong@oracle.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git reserve-rt-metadata-space
head: 207e1ccd65605924e87691251452a581587d26d2
commit: 2abf21a89e265202ca879cbca962109544b3a557 [153/219] xfs: move orphan files to the orphanage
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
"cppcheck warnings: (new ones prefixed by >>)"
>> fs/xfs/scrub/repair.c:1819:15: warning: %d in format string (no. 2) requires 'int' but the argument type is 'unsigned int'. [invalidPrintfArgType_sint]
xname.len = snprintf(fname, sizeof(fname), "%llu.%d",
^
fs/xfs/scrub/repair.c:270:6: warning: Uninitialized variable: freelen [uninitvar]
freelen >= aglen) {
^
vim +1819 fs/xfs/scrub/repair.c
2abf21a89e26520 Darrick J. Wong 2020-11-17 1782
2abf21a89e26520 Darrick J. Wong 2020-11-17 1783 /*
2abf21a89e26520 Darrick J. Wong 2020-11-17 1784 * Move the current file to the orphanage. The caller must not hold any locks
2abf21a89e26520 Darrick J. Wong 2020-11-17 1785 * on the orphanage and must not hold the ILOCK on sc->ip. sc->ip and
2abf21a89e26520 Darrick J. Wong 2020-11-17 1786 * sc->orphanage must not be joined to the transaction. The function returns
2abf21a89e26520 Darrick J. Wong 2020-11-17 1787 * with both inodes joined, ILOCKed, and dirty.
2abf21a89e26520 Darrick J. Wong 2020-11-17 1788 */
2abf21a89e26520 Darrick J. Wong 2020-11-17 1789 int
2abf21a89e26520 Darrick J. Wong 2020-11-17 1790 xrep_move_to_orphanage(
2abf21a89e26520 Darrick J. Wong 2020-11-17 1791 struct xfs_scrub *sc)
2abf21a89e26520 Darrick J. Wong 2020-11-17 1792 {
2abf21a89e26520 Darrick J. Wong 2020-11-17 1793 struct xfs_name xname;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1794 unsigned char fname[MAXNAMELEN + 1];
2abf21a89e26520 Darrick J. Wong 2020-11-17 1795 struct xfs_inode *dp = sc->orphanage;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1796 struct xfs_mount *mp = sc->mp;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1797 xfs_ino_t ino;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1798 unsigned int incr = 0;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1799 unsigned int linkres, dotdotres;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1800 int error;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1801
2abf21a89e26520 Darrick J. Wong 2020-11-17 1802 /* No orphanage? We can't fix this. */
2abf21a89e26520 Darrick J. Wong 2020-11-17 1803 if (!sc->orphanage)
2abf21a89e26520 Darrick J. Wong 2020-11-17 1804 return -EFSCORRUPTED;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1805
2abf21a89e26520 Darrick J. Wong 2020-11-17 1806 /* Try to grab the IOLOCK on the orphanage. */
2abf21a89e26520 Darrick J. Wong 2020-11-17 1807 error = xchk_ilock_inverted(sc->orphanage, XFS_IOLOCK_EXCL);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1808 if (error)
2abf21a89e26520 Darrick J. Wong 2020-11-17 1809 return error;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1810 sc->orphanage_ilock_flags |= XFS_IOLOCK_EXCL;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1811
2abf21a89e26520 Darrick J. Wong 2020-11-17 1812 xname.name = fname;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1813 xname.len = snprintf(fname, sizeof(fname), "%llu", sc->ip->i_ino);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1814 xname.type = xfs_mode_to_ftype(VFS_I(sc->ip)->i_mode);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1815
2abf21a89e26520 Darrick J. Wong 2020-11-17 1816 /* Make sure the filename is unique in the lost+found. */
2abf21a89e26520 Darrick J. Wong 2020-11-17 1817 error = xfs_dir_lookup(sc->tp, dp, &xname, &ino, NULL);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1818 while (error == 0 && incr < 10000) {
2abf21a89e26520 Darrick J. Wong 2020-11-17 @1819 xname.len = snprintf(fname, sizeof(fname), "%llu.%d",
2abf21a89e26520 Darrick J. Wong 2020-11-17 1820 sc->ip->i_ino, ++incr);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1821 error = xfs_dir_lookup(sc->tp, dp, &xname, &ino, NULL);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1822 }
2abf21a89e26520 Darrick J. Wong 2020-11-17 1823 if (error == 0) {
2abf21a89e26520 Darrick J. Wong 2020-11-17 1824 /* We already have 10,000 entries in the orphanage? */
2abf21a89e26520 Darrick J. Wong 2020-11-17 1825 return -EFSCORRUPTED;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1826 }
2abf21a89e26520 Darrick J. Wong 2020-11-17 1827 if (error != -ENOENT)
2abf21a89e26520 Darrick J. Wong 2020-11-17 1828 return error;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1829
2abf21a89e26520 Darrick J. Wong 2020-11-17 1830 trace_xrep_move_orphanage(sc->ip, &xname, dp->i_ino);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1831
2abf21a89e26520 Darrick J. Wong 2020-11-17 1832 /*
2abf21a89e26520 Darrick J. Wong 2020-11-17 1833 * Reserve enough space to add a directory entry to the orphanage and
2abf21a89e26520 Darrick J. Wong 2020-11-17 1834 * update the dotdot entry.
2abf21a89e26520 Darrick J. Wong 2020-11-17 1835 */
2abf21a89e26520 Darrick J. Wong 2020-11-17 1836 linkres = XFS_LINK_SPACE_RES(mp, xname.len);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1837 dotdotres = XFS_RENAME_SPACE_RES(mp, 2);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1838 error = xfs_trans_reserve_more(sc->tp, linkres + dotdotres, 0);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1839 if (error)
2abf21a89e26520 Darrick J. Wong 2020-11-17 1840 return error;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1841
2abf21a89e26520 Darrick J. Wong 2020-11-17 1842 xfs_lock_two_inodes(dp, XFS_ILOCK_EXCL, sc->ip, XFS_ILOCK_EXCL);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1843 sc->ilock_flags |= XFS_ILOCK_EXCL;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1844 sc->orphanage_ilock_flags |= XFS_ILOCK_EXCL;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1845
2abf21a89e26520 Darrick J. Wong 2020-11-17 1846 xfs_trans_ijoin(sc->tp, dp, 0);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1847 xfs_trans_ijoin(sc->tp, sc->ip, 0);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1848
2abf21a89e26520 Darrick J. Wong 2020-11-17 1849 /*
2abf21a89e26520 Darrick J. Wong 2020-11-17 1850 * Create the new name in the orphanage, and bump the link count of
2abf21a89e26520 Darrick J. Wong 2020-11-17 1851 * the orphanage if we just added a directory.
2abf21a89e26520 Darrick J. Wong 2020-11-17 1852 */
2abf21a89e26520 Darrick J. Wong 2020-11-17 1853 error = xfs_dir_createname(sc->tp, dp, &xname, sc->ip->i_ino,
2abf21a89e26520 Darrick J. Wong 2020-11-17 1854 linkres);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1855 if (error)
2abf21a89e26520 Darrick J. Wong 2020-11-17 1856 return error;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1857
2abf21a89e26520 Darrick J. Wong 2020-11-17 1858 xfs_trans_ichgtime(sc->tp, dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1859 if (S_ISDIR(VFS_I(sc->ip)->i_mode))
2abf21a89e26520 Darrick J. Wong 2020-11-17 1860 xfs_bumplink(sc->tp, dp);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1861 xfs_trans_log_inode(sc->tp, dp, XFS_ILOG_CORE);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1862
2abf21a89e26520 Darrick J. Wong 2020-11-17 1863 /* Replace the dotdot entry. */
2abf21a89e26520 Darrick J. Wong 2020-11-17 1864 return xfs_dir_replace(sc->tp, sc->ip, &xfs_name_dotdot, dp->i_ino,
2abf21a89e26520 Darrick J. Wong 2020-11-17 1865 dotdotres);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1866 }
2abf21a89e26520 Darrick J. Wong 2020-11-17 1867
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 4+ messages in thread
* [djwong-xfs:reserve-rt-metadata-space 153/219] fs/xfs/scrub/repair.c:1819:15: warning: %d in format string (no. 2) requires 'int' but the argument type is 'unsigned int'.
@ 2020-12-21 0:20 kernel test robot
0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2020-12-21 0:20 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 7899 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git reserve-rt-metadata-space
head: 207e1ccd65605924e87691251452a581587d26d2
commit: 2abf21a89e265202ca879cbca962109544b3a557 [153/219] xfs: move orphan files to the orphanage
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <rong.a.chen@intel.com>
"cppcheck warnings: (new ones prefixed by >>)"
>> fs/xfs/scrub/repair.c:1819:15: warning: %d in format string (no. 2) requires 'int' but the argument type is 'unsigned int'. [invalidPrintfArgType_sint]
xname.len = snprintf(fname, sizeof(fname), "%llu.%d",
^
fs/xfs/scrub/repair.c:270:6: warning: Uninitialized variable: freelen [uninitvar]
freelen >= aglen) {
^
vim +1819 fs/xfs/scrub/repair.c
2abf21a89e26520 Darrick J. Wong 2020-11-17 1782
2abf21a89e26520 Darrick J. Wong 2020-11-17 1783 /*
2abf21a89e26520 Darrick J. Wong 2020-11-17 1784 * Move the current file to the orphanage. The caller must not hold any locks
2abf21a89e26520 Darrick J. Wong 2020-11-17 1785 * on the orphanage and must not hold the ILOCK on sc->ip. sc->ip and
2abf21a89e26520 Darrick J. Wong 2020-11-17 1786 * sc->orphanage must not be joined to the transaction. The function returns
2abf21a89e26520 Darrick J. Wong 2020-11-17 1787 * with both inodes joined, ILOCKed, and dirty.
2abf21a89e26520 Darrick J. Wong 2020-11-17 1788 */
2abf21a89e26520 Darrick J. Wong 2020-11-17 1789 int
2abf21a89e26520 Darrick J. Wong 2020-11-17 1790 xrep_move_to_orphanage(
2abf21a89e26520 Darrick J. Wong 2020-11-17 1791 struct xfs_scrub *sc)
2abf21a89e26520 Darrick J. Wong 2020-11-17 1792 {
2abf21a89e26520 Darrick J. Wong 2020-11-17 1793 struct xfs_name xname;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1794 unsigned char fname[MAXNAMELEN + 1];
2abf21a89e26520 Darrick J. Wong 2020-11-17 1795 struct xfs_inode *dp = sc->orphanage;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1796 struct xfs_mount *mp = sc->mp;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1797 xfs_ino_t ino;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1798 unsigned int incr = 0;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1799 unsigned int linkres, dotdotres;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1800 int error;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1801
2abf21a89e26520 Darrick J. Wong 2020-11-17 1802 /* No orphanage? We can't fix this. */
2abf21a89e26520 Darrick J. Wong 2020-11-17 1803 if (!sc->orphanage)
2abf21a89e26520 Darrick J. Wong 2020-11-17 1804 return -EFSCORRUPTED;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1805
2abf21a89e26520 Darrick J. Wong 2020-11-17 1806 /* Try to grab the IOLOCK on the orphanage. */
2abf21a89e26520 Darrick J. Wong 2020-11-17 1807 error = xchk_ilock_inverted(sc->orphanage, XFS_IOLOCK_EXCL);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1808 if (error)
2abf21a89e26520 Darrick J. Wong 2020-11-17 1809 return error;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1810 sc->orphanage_ilock_flags |= XFS_IOLOCK_EXCL;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1811
2abf21a89e26520 Darrick J. Wong 2020-11-17 1812 xname.name = fname;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1813 xname.len = snprintf(fname, sizeof(fname), "%llu", sc->ip->i_ino);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1814 xname.type = xfs_mode_to_ftype(VFS_I(sc->ip)->i_mode);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1815
2abf21a89e26520 Darrick J. Wong 2020-11-17 1816 /* Make sure the filename is unique in the lost+found. */
2abf21a89e26520 Darrick J. Wong 2020-11-17 1817 error = xfs_dir_lookup(sc->tp, dp, &xname, &ino, NULL);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1818 while (error == 0 && incr < 10000) {
2abf21a89e26520 Darrick J. Wong 2020-11-17 @1819 xname.len = snprintf(fname, sizeof(fname), "%llu.%d",
2abf21a89e26520 Darrick J. Wong 2020-11-17 1820 sc->ip->i_ino, ++incr);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1821 error = xfs_dir_lookup(sc->tp, dp, &xname, &ino, NULL);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1822 }
2abf21a89e26520 Darrick J. Wong 2020-11-17 1823 if (error == 0) {
2abf21a89e26520 Darrick J. Wong 2020-11-17 1824 /* We already have 10,000 entries in the orphanage? */
2abf21a89e26520 Darrick J. Wong 2020-11-17 1825 return -EFSCORRUPTED;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1826 }
2abf21a89e26520 Darrick J. Wong 2020-11-17 1827 if (error != -ENOENT)
2abf21a89e26520 Darrick J. Wong 2020-11-17 1828 return error;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1829
2abf21a89e26520 Darrick J. Wong 2020-11-17 1830 trace_xrep_move_orphanage(sc->ip, &xname, dp->i_ino);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1831
2abf21a89e26520 Darrick J. Wong 2020-11-17 1832 /*
2abf21a89e26520 Darrick J. Wong 2020-11-17 1833 * Reserve enough space to add a directory entry to the orphanage and
2abf21a89e26520 Darrick J. Wong 2020-11-17 1834 * update the dotdot entry.
2abf21a89e26520 Darrick J. Wong 2020-11-17 1835 */
2abf21a89e26520 Darrick J. Wong 2020-11-17 1836 linkres = XFS_LINK_SPACE_RES(mp, xname.len);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1837 dotdotres = XFS_RENAME_SPACE_RES(mp, 2);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1838 error = xfs_trans_reserve_more(sc->tp, linkres + dotdotres, 0);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1839 if (error)
2abf21a89e26520 Darrick J. Wong 2020-11-17 1840 return error;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1841
2abf21a89e26520 Darrick J. Wong 2020-11-17 1842 xfs_lock_two_inodes(dp, XFS_ILOCK_EXCL, sc->ip, XFS_ILOCK_EXCL);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1843 sc->ilock_flags |= XFS_ILOCK_EXCL;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1844 sc->orphanage_ilock_flags |= XFS_ILOCK_EXCL;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1845
2abf21a89e26520 Darrick J. Wong 2020-11-17 1846 xfs_trans_ijoin(sc->tp, dp, 0);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1847 xfs_trans_ijoin(sc->tp, sc->ip, 0);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1848
2abf21a89e26520 Darrick J. Wong 2020-11-17 1849 /*
2abf21a89e26520 Darrick J. Wong 2020-11-17 1850 * Create the new name in the orphanage, and bump the link count of
2abf21a89e26520 Darrick J. Wong 2020-11-17 1851 * the orphanage if we just added a directory.
2abf21a89e26520 Darrick J. Wong 2020-11-17 1852 */
2abf21a89e26520 Darrick J. Wong 2020-11-17 1853 error = xfs_dir_createname(sc->tp, dp, &xname, sc->ip->i_ino,
2abf21a89e26520 Darrick J. Wong 2020-11-17 1854 linkres);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1855 if (error)
2abf21a89e26520 Darrick J. Wong 2020-11-17 1856 return error;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1857
2abf21a89e26520 Darrick J. Wong 2020-11-17 1858 xfs_trans_ichgtime(sc->tp, dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1859 if (S_ISDIR(VFS_I(sc->ip)->i_mode))
2abf21a89e26520 Darrick J. Wong 2020-11-17 1860 xfs_bumplink(sc->tp, dp);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1861 xfs_trans_log_inode(sc->tp, dp, XFS_ILOG_CORE);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1862
2abf21a89e26520 Darrick J. Wong 2020-11-17 1863 /* Replace the dotdot entry. */
2abf21a89e26520 Darrick J. Wong 2020-11-17 1864 return xfs_dir_replace(sc->tp, sc->ip, &xfs_name_dotdot, dp->i_ino,
2abf21a89e26520 Darrick J. Wong 2020-11-17 1865 dotdotres);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1866 }
2abf21a89e26520 Darrick J. Wong 2020-11-17 1867
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 4+ messages in thread
* [djwong-xfs:reserve-rt-metadata-space 153/219] fs/xfs/scrub/repair.c:1819:15: warning: %d in format string (no. 2) requires 'int' but the argument type is 'unsigned int'.
@ 2020-12-19 15:59 kernel test robot
0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2020-12-19 15:59 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 8090 bytes --]
CC: kbuild-all(a)lists.01.org
CC: "Darrick J. Wong" <darrick.wong@oracle.com>
TO: "Darrick J. Wong" <darrick.wong@oracle.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git reserve-rt-metadata-space
head: 207e1ccd65605924e87691251452a581587d26d2
commit: 2abf21a89e265202ca879cbca962109544b3a557 [153/219] xfs: move orphan files to the orphanage
:::::: branch date: 14 hours ago
:::::: commit date: 14 hours ago
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
"cppcheck warnings: (new ones prefixed by >>)"
>> fs/xfs/scrub/repair.c:1819:15: warning: %d in format string (no. 2) requires 'int' but the argument type is 'unsigned int'. [invalidPrintfArgType_sint]
xname.len = snprintf(fname, sizeof(fname), "%llu.%d",
^
fs/xfs/scrub/repair.c:270:6: warning: Uninitialized variable: freelen [uninitvar]
freelen >= aglen) {
^
vim +1819 fs/xfs/scrub/repair.c
2abf21a89e26520 Darrick J. Wong 2020-11-17 1782
2abf21a89e26520 Darrick J. Wong 2020-11-17 1783 /*
2abf21a89e26520 Darrick J. Wong 2020-11-17 1784 * Move the current file to the orphanage. The caller must not hold any locks
2abf21a89e26520 Darrick J. Wong 2020-11-17 1785 * on the orphanage and must not hold the ILOCK on sc->ip. sc->ip and
2abf21a89e26520 Darrick J. Wong 2020-11-17 1786 * sc->orphanage must not be joined to the transaction. The function returns
2abf21a89e26520 Darrick J. Wong 2020-11-17 1787 * with both inodes joined, ILOCKed, and dirty.
2abf21a89e26520 Darrick J. Wong 2020-11-17 1788 */
2abf21a89e26520 Darrick J. Wong 2020-11-17 1789 int
2abf21a89e26520 Darrick J. Wong 2020-11-17 1790 xrep_move_to_orphanage(
2abf21a89e26520 Darrick J. Wong 2020-11-17 1791 struct xfs_scrub *sc)
2abf21a89e26520 Darrick J. Wong 2020-11-17 1792 {
2abf21a89e26520 Darrick J. Wong 2020-11-17 1793 struct xfs_name xname;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1794 unsigned char fname[MAXNAMELEN + 1];
2abf21a89e26520 Darrick J. Wong 2020-11-17 1795 struct xfs_inode *dp = sc->orphanage;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1796 struct xfs_mount *mp = sc->mp;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1797 xfs_ino_t ino;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1798 unsigned int incr = 0;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1799 unsigned int linkres, dotdotres;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1800 int error;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1801
2abf21a89e26520 Darrick J. Wong 2020-11-17 1802 /* No orphanage? We can't fix this. */
2abf21a89e26520 Darrick J. Wong 2020-11-17 1803 if (!sc->orphanage)
2abf21a89e26520 Darrick J. Wong 2020-11-17 1804 return -EFSCORRUPTED;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1805
2abf21a89e26520 Darrick J. Wong 2020-11-17 1806 /* Try to grab the IOLOCK on the orphanage. */
2abf21a89e26520 Darrick J. Wong 2020-11-17 1807 error = xchk_ilock_inverted(sc->orphanage, XFS_IOLOCK_EXCL);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1808 if (error)
2abf21a89e26520 Darrick J. Wong 2020-11-17 1809 return error;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1810 sc->orphanage_ilock_flags |= XFS_IOLOCK_EXCL;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1811
2abf21a89e26520 Darrick J. Wong 2020-11-17 1812 xname.name = fname;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1813 xname.len = snprintf(fname, sizeof(fname), "%llu", sc->ip->i_ino);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1814 xname.type = xfs_mode_to_ftype(VFS_I(sc->ip)->i_mode);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1815
2abf21a89e26520 Darrick J. Wong 2020-11-17 1816 /* Make sure the filename is unique in the lost+found. */
2abf21a89e26520 Darrick J. Wong 2020-11-17 1817 error = xfs_dir_lookup(sc->tp, dp, &xname, &ino, NULL);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1818 while (error == 0 && incr < 10000) {
2abf21a89e26520 Darrick J. Wong 2020-11-17 @1819 xname.len = snprintf(fname, sizeof(fname), "%llu.%d",
2abf21a89e26520 Darrick J. Wong 2020-11-17 1820 sc->ip->i_ino, ++incr);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1821 error = xfs_dir_lookup(sc->tp, dp, &xname, &ino, NULL);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1822 }
2abf21a89e26520 Darrick J. Wong 2020-11-17 1823 if (error == 0) {
2abf21a89e26520 Darrick J. Wong 2020-11-17 1824 /* We already have 10,000 entries in the orphanage? */
2abf21a89e26520 Darrick J. Wong 2020-11-17 1825 return -EFSCORRUPTED;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1826 }
2abf21a89e26520 Darrick J. Wong 2020-11-17 1827 if (error != -ENOENT)
2abf21a89e26520 Darrick J. Wong 2020-11-17 1828 return error;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1829
2abf21a89e26520 Darrick J. Wong 2020-11-17 1830 trace_xrep_move_orphanage(sc->ip, &xname, dp->i_ino);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1831
2abf21a89e26520 Darrick J. Wong 2020-11-17 1832 /*
2abf21a89e26520 Darrick J. Wong 2020-11-17 1833 * Reserve enough space to add a directory entry to the orphanage and
2abf21a89e26520 Darrick J. Wong 2020-11-17 1834 * update the dotdot entry.
2abf21a89e26520 Darrick J. Wong 2020-11-17 1835 */
2abf21a89e26520 Darrick J. Wong 2020-11-17 1836 linkres = XFS_LINK_SPACE_RES(mp, xname.len);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1837 dotdotres = XFS_RENAME_SPACE_RES(mp, 2);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1838 error = xfs_trans_reserve_more(sc->tp, linkres + dotdotres, 0);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1839 if (error)
2abf21a89e26520 Darrick J. Wong 2020-11-17 1840 return error;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1841
2abf21a89e26520 Darrick J. Wong 2020-11-17 1842 xfs_lock_two_inodes(dp, XFS_ILOCK_EXCL, sc->ip, XFS_ILOCK_EXCL);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1843 sc->ilock_flags |= XFS_ILOCK_EXCL;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1844 sc->orphanage_ilock_flags |= XFS_ILOCK_EXCL;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1845
2abf21a89e26520 Darrick J. Wong 2020-11-17 1846 xfs_trans_ijoin(sc->tp, dp, 0);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1847 xfs_trans_ijoin(sc->tp, sc->ip, 0);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1848
2abf21a89e26520 Darrick J. Wong 2020-11-17 1849 /*
2abf21a89e26520 Darrick J. Wong 2020-11-17 1850 * Create the new name in the orphanage, and bump the link count of
2abf21a89e26520 Darrick J. Wong 2020-11-17 1851 * the orphanage if we just added a directory.
2abf21a89e26520 Darrick J. Wong 2020-11-17 1852 */
2abf21a89e26520 Darrick J. Wong 2020-11-17 1853 error = xfs_dir_createname(sc->tp, dp, &xname, sc->ip->i_ino,
2abf21a89e26520 Darrick J. Wong 2020-11-17 1854 linkres);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1855 if (error)
2abf21a89e26520 Darrick J. Wong 2020-11-17 1856 return error;
2abf21a89e26520 Darrick J. Wong 2020-11-17 1857
2abf21a89e26520 Darrick J. Wong 2020-11-17 1858 xfs_trans_ichgtime(sc->tp, dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1859 if (S_ISDIR(VFS_I(sc->ip)->i_mode))
2abf21a89e26520 Darrick J. Wong 2020-11-17 1860 xfs_bumplink(sc->tp, dp);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1861 xfs_trans_log_inode(sc->tp, dp, XFS_ILOG_CORE);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1862
2abf21a89e26520 Darrick J. Wong 2020-11-17 1863 /* Replace the dotdot entry. */
2abf21a89e26520 Darrick J. Wong 2020-11-17 1864 return xfs_dir_replace(sc->tp, sc->ip, &xfs_name_dotdot, dp->i_ino,
2abf21a89e26520 Darrick J. Wong 2020-11-17 1865 dotdotres);
2abf21a89e26520 Darrick J. Wong 2020-11-17 1866 }
2abf21a89e26520 Darrick J. Wong 2020-11-17 1867
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-12-21 9:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-21 9:20 [djwong-xfs:reserve-rt-metadata-space 153/219] fs/xfs/scrub/repair.c:1819:15: warning: %d in format string (no. 2) requires 'int' but the argument type is 'unsigned int' kernel test robot
-- strict thread matches above, loose matches on Subject: below --
2020-12-21 7:35 kernel test robot
2020-12-21 0:20 kernel test robot
2020-12-19 15:59 kernel test robot
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.