CC: [email protected] CC: "Darrick J. Wong" <[email protected]> TO: "Darrick J. Wong" <[email protected]>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git refactor-log-recovery head: 2dcdc305cfc2b8b1beee483cf8ae5c674d9fac86 commit: 66666ad3b019f5433ae32bb3bb62bb6f2a2e4497 [235/314] xfs: enable bigtime for quota timers :::::: branch date: 9 hours ago :::::: commit date: 9 hours ago If you fix the issue, kindly add following tag as appropriate Reported-by: kbuild test robot <[email protected]> cppcheck warnings: (new ones prefixed by >>) >> fs/xfs/xfs_dquot.c:1210:30: warning: Label '__here' is not used. >> [unusedLabel] be32_to_cpu(ddqp->d_id), __this_address); ^ fs/xfs/xfs_buf.h:278:38: warning: Clarify calculation precedence for '&' and '?'. [clarifyCalculation] bool wait = bp->b_flags & XBF_ASYNC ? false : true; ^ fs/xfs/xfs_dquot.c:281:28: warning: Clarify calculation precedence for '&' and '?'. [clarifyCalculation] (type & XFS_DQ_USER ? XFS_BLF_UDQUOT_BUF : ^ fs/xfs/xfs_dquot.c:539:43: warning: 'bp->b_addr' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. [arithOperationsOnVoidPointer] struct xfs_disk_dquot *ddqp = bp->b_addr + dqp->q_bufoffset; ^ fs/xfs/xfs_dquot.c:1183:19: warning: 'bp->b_addr' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined. [arithOperationsOnVoidPointer] dqb = bp->b_addr + dqp->q_bufoffset; ^ >> fs/xfs/xfs_dquot.c:1210:30: warning: Variable '__here' is not assigned a >> value. [unassignedVariable] be32_to_cpu(ddqp->d_id), __this_address); ^ nofile:0:0: warning: Too many #ifdef configurations - cppcheck only checks 12 configurations. Use --force to check all configurations. For more details, use --enable=information. [toomanyconfigs] # https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git/commit/?id=66666ad3b019f5433ae32bb3bb62bb6f2a2e4497 git remote add djwong-xfs https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git git remote update djwong-xfs git checkout 66666ad3b019f5433ae32bb3bb62bb6f2a2e4497 vim +/__here +1210 fs/xfs/xfs_dquot.c ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1121 ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1122 /* ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1123 * Write a modified dquot to disk. ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1124 * The dquot must be locked and the flush lock too taken by caller. ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1125 * The flush lock will not be unlocked until the dquot reaches the disk, ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1126 * but the dquot is free to be unlocked and modified by the caller ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1127 * in the interim. Dquot is still locked on return. This behavior is ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1128 * identical to that of inodes. ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1129 */ ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1130 int ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1131 xfs_qm_dqflush( fe7257fd4b8ae9 fs/xfs/xfs_dquot.c Christoph Hellwig 2012-04-23 1132 struct xfs_dquot *dqp, fe7257fd4b8ae9 fs/xfs/xfs_dquot.c Christoph Hellwig 2012-04-23 1133 struct xfs_buf **bpp) ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1134 { acecf1b5d8a846 fs/xfs/quota/xfs_dquot.c Christoph Hellwig 2010-09-06 1135 struct xfs_mount *mp = dqp->q_mount; acecf1b5d8a846 fs/xfs/quota/xfs_dquot.c Christoph Hellwig 2010-09-06 1136 struct xfs_buf *bp; 7224fa482a6daa fs/xfs/xfs_dquot.c Eric Sandeen 2018-05-07 1137 struct xfs_dqblk *dqb; acecf1b5d8a846 fs/xfs/quota/xfs_dquot.c Christoph Hellwig 2010-09-06 1138 struct xfs_disk_dquot *ddqp; eebf3cab9c5eac fs/xfs/xfs_dquot.c Darrick J. Wong 2018-01-08 1139 xfs_failaddr_t fa; ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1140 int error; ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1141 ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1142 ASSERT(XFS_DQ_IS_LOCKED(dqp)); e1f49cf20cea18 fs/xfs/quota/xfs_dquot.c David Chinner 2008-08-13 1143 ASSERT(!completion_done(&dqp->q_flush)); acecf1b5d8a846 fs/xfs/quota/xfs_dquot.c Christoph Hellwig 2010-09-06 1144 0b1b213fcf3a84 fs/xfs/quota/xfs_dquot.c Christoph Hellwig 2009-12-14 1145 trace_xfs_dqflush(dqp); ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1146 fe7257fd4b8ae9 fs/xfs/xfs_dquot.c Christoph Hellwig 2012-04-23 1147 *bpp = NULL; fe7257fd4b8ae9 fs/xfs/xfs_dquot.c Christoph Hellwig 2012-04-23 1148 ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1149 xfs_qm_dqunpin_wait(dqp); ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1150 ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1151 /* ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1152 * This may have been unpinned because the filesystem is shutting ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1153 * down forcibly. If that's the case we must not write this dquot dea9609527a55b fs/xfs/xfs_dquot.c Christoph Hellwig 2012-04-23 1154 * to disk, because the log record didn't make it to disk. dea9609527a55b fs/xfs/xfs_dquot.c Christoph Hellwig 2012-04-23 1155 * dea9609527a55b fs/xfs/xfs_dquot.c Christoph Hellwig 2012-04-23 1156 * We also have to remove the log item from the AIL in this case, dea9609527a55b fs/xfs/xfs_dquot.c Christoph Hellwig 2012-04-23 1157 * as we wait for an emptry AIL as part of the unmount process. ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1158 */ acecf1b5d8a846 fs/xfs/quota/xfs_dquot.c Christoph Hellwig 2010-09-06 1159 if (XFS_FORCED_SHUTDOWN(mp)) { dea9609527a55b fs/xfs/xfs_dquot.c Christoph Hellwig 2012-04-23 1160 struct xfs_log_item *lip = &dqp->q_logitem.qli_item; acecf1b5d8a846 fs/xfs/quota/xfs_dquot.c Christoph Hellwig 2010-09-06 1161 dqp->dq_flags &= ~XFS_DQ_DIRTY; dea9609527a55b fs/xfs/xfs_dquot.c Christoph Hellwig 2012-04-23 1162 146e54b71ea4b9 fs/xfs/xfs_dquot.c Brian Foster 2015-08-19 1163 xfs_trans_ail_remove(lip, SHUTDOWN_CORRUPT_INCORE); 146e54b71ea4b9 fs/xfs/xfs_dquot.c Brian Foster 2015-08-19 1164 2451337dd04390 fs/xfs/xfs_dquot.c Dave Chinner 2014-06-25 1165 error = -EIO; fe7257fd4b8ae9 fs/xfs/xfs_dquot.c Christoph Hellwig 2012-04-23 1166 goto out_unlock; ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1167 } ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1168 ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1169 /* ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1170 * Get the buffer containing the on-disk dquot ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1171 */ acecf1b5d8a846 fs/xfs/quota/xfs_dquot.c Christoph Hellwig 2010-09-06 1172 error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp, dqp->q_blkno, 2abd3d3dc09e58 fs/xfs/xfs_dquot.c Brian Foster 2020-04-03 1173 mp->m_quotainfo->qi_dqchunklen, XBF_TRYLOCK, 2abd3d3dc09e58 fs/xfs/xfs_dquot.c Brian Foster 2020-04-03 1174 &bp, &xfs_dquot_buf_ops); bbf9cbafcf73b3 fs/xfs/xfs_dquot.c Darrick J. Wong 2020-02-19 1175 if (xfs_metadata_is_sick(error)) bbf9cbafcf73b3 fs/xfs/xfs_dquot.c Darrick J. Wong 2020-02-19 1176 xfs_quota_mark_sick(mp, dqp->dq_flags); fe7257fd4b8ae9 fs/xfs/xfs_dquot.c Christoph Hellwig 2012-04-23 1177 if (error) fe7257fd4b8ae9 fs/xfs/xfs_dquot.c Christoph Hellwig 2012-04-23 1178 goto out_unlock; ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1179 acecf1b5d8a846 fs/xfs/quota/xfs_dquot.c Christoph Hellwig 2010-09-06 1180 /* acecf1b5d8a846 fs/xfs/quota/xfs_dquot.c Christoph Hellwig 2010-09-06 1181 * Calculate the location of the dquot inside the buffer. acecf1b5d8a846 fs/xfs/quota/xfs_dquot.c Christoph Hellwig 2010-09-06 1182 */ 7224fa482a6daa fs/xfs/xfs_dquot.c Eric Sandeen 2018-05-07 1183 dqb = bp->b_addr + dqp->q_bufoffset; 7224fa482a6daa fs/xfs/xfs_dquot.c Eric Sandeen 2018-05-07 1184 ddqp = &dqb->dd_diskdq; acecf1b5d8a846 fs/xfs/quota/xfs_dquot.c Christoph Hellwig 2010-09-06 1185 acecf1b5d8a846 fs/xfs/quota/xfs_dquot.c Christoph Hellwig 2010-09-06 1186 /* 7224fa482a6daa fs/xfs/xfs_dquot.c Eric Sandeen 2018-05-07 1187 * A simple sanity check in case we got a corrupted dquot. acecf1b5d8a846 fs/xfs/quota/xfs_dquot.c Christoph Hellwig 2010-09-06 1188 */ 7224fa482a6daa fs/xfs/xfs_dquot.c Eric Sandeen 2018-05-07 1189 fa = xfs_dqblk_verify(mp, dqb, be32_to_cpu(ddqp->d_id), 0); eebf3cab9c5eac fs/xfs/xfs_dquot.c Darrick J. Wong 2018-01-08 1190 if (fa) { eebf3cab9c5eac fs/xfs/xfs_dquot.c Darrick J. Wong 2018-01-08 1191 xfs_alert(mp, "corrupt dquot ID 0x%x in memory at %pS", eebf3cab9c5eac fs/xfs/xfs_dquot.c Darrick J. Wong 2018-01-08 1192 be32_to_cpu(ddqp->d_id), fa); acecf1b5d8a846 fs/xfs/quota/xfs_dquot.c Christoph Hellwig 2010-09-06 1193 xfs_buf_relse(bp); acecf1b5d8a846 fs/xfs/quota/xfs_dquot.c Christoph Hellwig 2010-09-06 1194 xfs_dqfunlock(dqp); acecf1b5d8a846 fs/xfs/quota/xfs_dquot.c Christoph Hellwig 2010-09-06 1195 xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); bbf9cbafcf73b3 fs/xfs/xfs_dquot.c Darrick J. Wong 2020-02-19 1196 xfs_quota_mark_sick(mp, dqp->dq_flags); c2414ad6e66ab9 fs/xfs/xfs_dquot.c Darrick J. Wong 2019-10-28 1197 return -EFSCORRUPTED; ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1198 } ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1199 ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1200 /* This is the only portion of data that needs to persist */ aefe69a45d8490 fs/xfs/xfs_dquot.c Pavel Reichl 2019-11-12 1201 memcpy(ddqp, &dqp->q_core, sizeof(struct xfs_disk_dquot)); ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1202 66666ad3b019f5 fs/xfs/xfs_dquot.c Darrick J. Wong 2020-02-19 1203 /* 66666ad3b019f5 fs/xfs/xfs_dquot.c Darrick J. Wong 2020-02-19 1204 * We should never write non-bigtime dquots to a bigtime fs, except for 66666ad3b019f5 fs/xfs/xfs_dquot.c Darrick J. Wong 2020-02-19 1205 * the root dquot. 66666ad3b019f5 fs/xfs/xfs_dquot.c Darrick J. Wong 2020-02-19 1206 */ 66666ad3b019f5 fs/xfs/xfs_dquot.c Darrick J. Wong 2020-02-19 1207 if (!(dqp->q_core.d_flags & XFS_DQ_BIGTIME) && dqp->q_core.d_id && 66666ad3b019f5 fs/xfs/xfs_dquot.c Darrick J. Wong 2020-02-19 1208 xfs_sb_version_hasbigtime(&mp->m_sb)) { 66666ad3b019f5 fs/xfs/xfs_dquot.c Darrick J. Wong 2020-02-19 1209 xfs_alert(mp, "corrupt dquot ID 0x%x in memory at %pS", 66666ad3b019f5 fs/xfs/xfs_dquot.c Darrick J. Wong 2020-02-19 @1210 be32_to_cpu(ddqp->d_id), __this_address); 66666ad3b019f5 fs/xfs/xfs_dquot.c Darrick J. Wong 2020-02-19 1211 xfs_buf_relse(bp); 66666ad3b019f5 fs/xfs/xfs_dquot.c Darrick J. Wong 2020-02-19 1212 xfs_dqfunlock(dqp); 66666ad3b019f5 fs/xfs/xfs_dquot.c Darrick J. Wong 2020-02-19 1213 xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); 66666ad3b019f5 fs/xfs/xfs_dquot.c Darrick J. Wong 2020-02-19 1214 xfs_quota_mark_sick(mp, dqp->dq_flags); 66666ad3b019f5 fs/xfs/xfs_dquot.c Darrick J. Wong 2020-02-19 1215 return -EFSCORRUPTED; 66666ad3b019f5 fs/xfs/xfs_dquot.c Darrick J. Wong 2020-02-19 1216 } 66666ad3b019f5 fs/xfs/xfs_dquot.c Darrick J. Wong 2020-02-19 1217 ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1218 /* ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1219 * Clear the dirty field and remember the flush lsn for later use. ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1220 */ acecf1b5d8a846 fs/xfs/quota/xfs_dquot.c Christoph Hellwig 2010-09-06 1221 dqp->dq_flags &= ~XFS_DQ_DIRTY; ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1222 7b2e2a31f5c23b fs/xfs/quota/xfs_dquot.c David Chinner 2008-10-30 1223 xfs_trans_ail_copy_lsn(mp->m_ail, &dqp->q_logitem.qli_flush_lsn, 7b2e2a31f5c23b fs/xfs/quota/xfs_dquot.c David Chinner 2008-10-30 1224 &dqp->q_logitem.qli_item.li_lsn); ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1225 3fe58f30b4fc3f fs/xfs/xfs_dquot.c Christoph Hellwig 2013-04-03 1226 /* 3fe58f30b4fc3f fs/xfs/xfs_dquot.c Christoph Hellwig 2013-04-03 1227 * copy the lsn into the on-disk dquot now while we have the in memory 3fe58f30b4fc3f fs/xfs/xfs_dquot.c Christoph Hellwig 2013-04-03 1228 * dquot here. This can't be done later in the write verifier as we 3fe58f30b4fc3f fs/xfs/xfs_dquot.c Christoph Hellwig 2013-04-03 1229 * can't get access to the log item at that point in time. 6fcdc59de28817 fs/xfs/xfs_dquot.c Dave Chinner 2013-06-03 1230 * 6fcdc59de28817 fs/xfs/xfs_dquot.c Dave Chinner 2013-06-03 1231 * We also calculate the CRC here so that the on-disk dquot in the 6fcdc59de28817 fs/xfs/xfs_dquot.c Dave Chinner 2013-06-03 1232 * buffer always has a valid CRC. This ensures there is no possibility 6fcdc59de28817 fs/xfs/xfs_dquot.c Dave Chinner 2013-06-03 1233 * of a dquot without an up-to-date CRC getting to disk. 3fe58f30b4fc3f fs/xfs/xfs_dquot.c Christoph Hellwig 2013-04-03 1234 */ 3fe58f30b4fc3f fs/xfs/xfs_dquot.c Christoph Hellwig 2013-04-03 1235 if (xfs_sb_version_hascrc(&mp->m_sb)) { 3fe58f30b4fc3f fs/xfs/xfs_dquot.c Christoph Hellwig 2013-04-03 1236 dqb->dd_lsn = cpu_to_be64(dqp->q_logitem.qli_item.li_lsn); 6fcdc59de28817 fs/xfs/xfs_dquot.c Dave Chinner 2013-06-03 1237 xfs_update_cksum((char *)dqb, sizeof(struct xfs_dqblk), 6fcdc59de28817 fs/xfs/xfs_dquot.c Dave Chinner 2013-06-03 1238 XFS_DQUOT_CRC_OFF); 3fe58f30b4fc3f fs/xfs/xfs_dquot.c Christoph Hellwig 2013-04-03 1239 } 3fe58f30b4fc3f fs/xfs/xfs_dquot.c Christoph Hellwig 2013-04-03 1240 ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1241 /* ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1242 * Attach an iodone routine so that we can remove this dquot from the ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1243 * AIL and release the flush lock once the dquot is synced to disk. ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1244 */ ca30b2a7b7ac89 fs/xfs/quota/xfs_dquot.c Christoph Hellwig 2010-06-23 1245 xfs_buf_attach_iodone(bp, xfs_qm_dqflush_done, ca30b2a7b7ac89 fs/xfs/quota/xfs_dquot.c Christoph Hellwig 2010-06-23 1246 &dqp->q_logitem.qli_item); ca30b2a7b7ac89 fs/xfs/quota/xfs_dquot.c Christoph Hellwig 2010-06-23 1247 ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1248 /* ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1249 * If the buffer is pinned then push on the log so we won't ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1250 * get stuck waiting in the write for too long. ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1251 */ 811e64c7169bb5 fs/xfs/quota/xfs_dquot.c Chandra Seetharaman 2011-07-22 1252 if (xfs_buf_ispinned(bp)) { 0b1b213fcf3a84 fs/xfs/quota/xfs_dquot.c Christoph Hellwig 2009-12-14 1253 trace_xfs_dqflush_force(dqp); a14a348bff2f99 fs/xfs/quota/xfs_dquot.c Christoph Hellwig 2010-01-19 1254 xfs_log_force(mp, 0); ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1255 } ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1256 0b1b213fcf3a84 fs/xfs/quota/xfs_dquot.c Christoph Hellwig 2009-12-14 1257 trace_xfs_dqflush_done(dqp); fe7257fd4b8ae9 fs/xfs/xfs_dquot.c Christoph Hellwig 2012-04-23 1258 *bpp = bp; fe7257fd4b8ae9 fs/xfs/xfs_dquot.c Christoph Hellwig 2012-04-23 1259 return 0; 0b1b213fcf3a84 fs/xfs/quota/xfs_dquot.c Christoph Hellwig 2009-12-14 1260 fe7257fd4b8ae9 fs/xfs/xfs_dquot.c Christoph Hellwig 2012-04-23 1261 out_unlock: fe7257fd4b8ae9 fs/xfs/xfs_dquot.c Christoph Hellwig 2012-04-23 1262 xfs_dqfunlock(dqp); 2abd3d3dc09e58 fs/xfs/xfs_dquot.c Brian Foster 2020-04-03 1263 return error; ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1264 } ^1da177e4c3f41 fs/xfs/quota/xfs_dquot.c Linus Torvalds 2005-04-16 1265 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/[email protected] _______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
