[djwong-xfs:llm-fixes-31 140/161] fs/xfs/scrub/inode.c:215:10: error: returning 'void' from a function with incompatible result type 'int'
kernel test robot <[email protected]>
| Newsgroups | dev.linux.lists.oe-kbuild-all |
|---|---|
| Message-ID | <[email protected]> |
tree: https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git llm-fixes-31 head: 99720b43a50e52830dacd44219a5f40dc8cab503 commit: 2e4dfa7b0b3e7bcac4c245421cf37c544e03a21e [140/161] xfs: always report inode repair setup failures config: arm64-randconfig-003-20260822 (https://download.01.org/0day-ci/archive/20260822/[email protected]/config) compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project 935bfc708590c60147a79c7df145bb6e68b1d388) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260822/[email protected]/reproduce) 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]> | Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ All errors (new ones prefixed by >>): >> fs/xfs/scrub/inode.c:215:10: error: returning 'void' from a function with incompatible result type 'int' 215 | return xrep_setup_inode(sc, &imap); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ fs/xfs/scrub/repair.h:241:36: note: expanded from macro 'xrep_setup_inode' 241 | #define xrep_setup_inode(sc, imap) ((void)0) | ^~~~~~~~~ 1 error generated. vim +215 fs/xfs/scrub/inode.c 81 82 /* 83 * Grab total control of the inode metadata. In the best case, we grab the 84 * incore inode and take all locks on it. If the incore inode cannot be 85 * constructed due to corruption problems, lock the AGI so that we can single 86 * step the loading process to fix everything that can go wrong. 87 */ 88 int 89 xchk_setup_inode( 90 struct xfs_scrub *sc) 91 { 92 struct xfs_imap imap; 93 struct xfs_inode *ip; 94 struct xfs_mount *mp = sc->mp; 95 struct xfs_inode *ip_in = XFS_I(file_inode(sc->file)); 96 struct xfs_buf *agi_bp; 97 struct xfs_perag *pag; 98 xfs_agnumber_t agno = XFS_INO_TO_AGNO(mp, sc->sm->sm_ino); 99 int error; 100 101 if (xchk_need_intent_drain(sc)) 102 xchk_fsgates_enable(sc, XCHK_FSGATES_DRAIN); 103 104 /* We want to scan the opened inode, so lock it and exit. */ 105 if (sc->sm->sm_ino == 0 || sc->sm->sm_ino == I_INO(ip_in)) { 106 error = xchk_install_live_inode(sc, ip_in); 107 if (error) 108 return error; 109 110 return xchk_prepare_iscrub(sc); 111 } 112 113 /* 114 * On pre-metadir filesystems, reject internal metadata files. For 115 * metadir filesystems, limited scrubbing of any file in the metadata 116 * directory tree by handle is allowed, because that is the only way to 117 * validate the lack of parent pointers in the sb-root metadata inodes. 118 */ 119 if (!xfs_has_metadir(mp) && xfs_is_sb_inum(mp, sc->sm->sm_ino)) 120 return -ENOENT; 121 /* Reject obviously bad inode numbers. */ 122 if (!xfs_verify_ino(sc->mp, sc->sm->sm_ino)) 123 return -ENOENT; 124 125 /* Try a safe untrusted iget. */ 126 error = xchk_iget_safe(sc, sc->sm->sm_ino, &ip); 127 if (!error) 128 return xchk_install_handle_iscrub(sc, ip); 129 if (error == -ENOENT) 130 return error; 131 if (error != -EFSCORRUPTED && error != -EFSBADCRC && error != -EINVAL) 132 goto out_error; 133 134 /* 135 * EINVAL with IGET_UNTRUSTED probably means one of several things: 136 * userspace gave us an inode number that doesn't correspond to fs 137 * space; the inode btree lacks a record for this inode; or there is 138 * a record, and it says this inode is free. 139 * 140 * EFSCORRUPTED/EFSBADCRC could mean that the inode was mappable, but 141 * some other metadata corruption (e.g. inode forks) prevented 142 * instantiation of the incore inode. Or it could mean the inobt is 143 * corrupt. 144 * 145 * We want to look up this inode in the inobt directly to distinguish 146 * three different scenarios: (1) the inobt says the inode is free, 147 * in which case there's nothing to do; (2) the inobt is corrupt so we 148 * should flag the corruption and exit to userspace to let it fix the 149 * inobt; and (3) the inobt says the inode is allocated, but loading it 150 * failed due to corruption. 151 * 152 * Allocate a transaction and grab the AGI to prevent inobt activity in 153 * this AG. Retry the iget in case someone allocated a new inode after 154 * the first iget failed. 155 */ 156 error = xchk_trans_alloc(sc, 0); 157 if (error) 158 goto out_error; 159 160 error = xchk_iget_agi(sc, sc->sm->sm_ino, &agi_bp, &ip); 161 if (error == 0) { 162 /* Actually got the incore inode, so install it and proceed. */ 163 xchk_trans_cancel(sc); 164 return xchk_install_handle_iscrub(sc, ip); 165 } 166 if (error == -ENOENT) 167 goto out_gone; 168 if (error != -EFSCORRUPTED && error != -EFSBADCRC && error != -EINVAL) 169 goto out_cancel; 170 171 /* Ensure that we have protected against inode allocation/freeing. */ 172 if (agi_bp == NULL) { 173 ASSERT(agi_bp != NULL); 174 error = -ECANCELED; 175 goto out_cancel; 176 } 177 178 /* 179 * Untrusted iget failed a second time. Let's try an inobt lookup. 180 * If the inobt doesn't think this is an allocated inode then we'll 181 * return ENOENT to signal that the check can be skipped. 182 * 183 * If the lookup signals corruption, we'll mark this inode corrupt and 184 * exit to userspace. There's little chance of fixing anything until 185 * the inobt is straightened out, but there's nothing we can do here. 186 * 187 * If the lookup encounters a runtime error, exit to userspace. 188 */ 189 pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, sc->sm->sm_ino)); 190 if (!pag) { 191 error = -EFSCORRUPTED; 192 goto out_cancel; 193 } 194 195 error = xfs_imap(pag, sc->tp, sc->sm->sm_ino, &imap, 196 XFS_IGET_UNTRUSTED); 197 xfs_perag_put(pag); 198 if (error == -EINVAL || error == -ENOENT) 199 goto out_gone; 200 if (error) 201 goto out_cancel; 202 203 /* 204 * The lookup succeeded. Chances are the ondisk inode is corrupt and 205 * preventing iget from reading it. Retain the scrub transaction and 206 * the AGI buffer to prevent anyone from allocating or freeing inodes. 207 * This ensures that we preserve the inconsistency between the inobt 208 * saying the inode is allocated and the icache being unable to load 209 * the inode until we can flag the corruption in xchk_inode. The 210 * scrub function has to note the corruption, since we're not really 211 * supposed to do that from the setup function. Save the mapping to 212 * make repairs to the ondisk inode buffer. 213 */ 214 if (xchk_could_repair(sc)) > 215 return xrep_setup_inode(sc, &imap); 216 return 0; 217 218 out_cancel: 219 xchk_trans_cancel(sc); 220 out_error: 221 trace_xchk_op_error(sc, agno, XFS_INO_TO_AGBNO(mp, sc->sm->sm_ino), 222 error, __return_address); 223 return error; 224 out_gone: 225 /* The file is gone, so there's nothing to check. */ 226 xchk_trans_cancel(sc); 227 return -ENOENT; 228 } 229 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki