CC: kbuild-all(a)lists.01.org CC: linux-kernel(a)vger.kernel.org TO: "Dave, Chinner," CC: "Darrick J. Wong" CC: Allison Collins tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 3d77e6a8804abcc0504c904bd6e5cdf3a5cf8162 commit: 0e7ab7efe77451cba4cbecb6c9f5ef83cf32b36b xfs: Throttle commits on delayed background CIL push date: 9 weeks ago :::::: branch date: 15 hours ago :::::: commit date: 9 weeks ago config: ia64-randconfig-s032-20200601 (attached as .config) compiler: ia64-linux-gcc (GCC) 9.3.0 reproduce: # apt-get install sparse # sparse version: v0.6.1-243-gc100a7ab-dirty git checkout 0e7ab7efe77451cba4cbecb6c9f5ef83cf32b36b # save the attached .config to linux build tree make W=1 C=1 ARCH=ia64 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' If you fix the issue, kindly add following tag as appropriate Reported-by: kbuild test robot sparse warnings: (new ones prefixed by >>) fs/xfs/xfs_log_cil.c:899:1: sparse: sparse: context imbalance in 'xlog_cil_push_background' - wrong count at exit >> fs/xfs/xfs_log_cil.c:1065:9: sparse: sparse: context imbalance in 'xfs_log_commit_cil' - unexpected unlock # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0e7ab7efe77451cba4cbecb6c9f5ef83cf32b36b git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git remote update linus git checkout 0e7ab7efe77451cba4cbecb6c9f5ef83cf32b36b vim +/xfs_log_commit_cil +1065 fs/xfs/xfs_log_cil.c 2c6e24ce1aa6b3 Dave Chinner 2013-10-15 997 a44f13edf0ebb4 Dave Chinner 2010-08-24 998 /* a44f13edf0ebb4 Dave Chinner 2010-08-24 999 * Commit a transaction with the given vector to the Committed Item List. a44f13edf0ebb4 Dave Chinner 2010-08-24 1000 * a44f13edf0ebb4 Dave Chinner 2010-08-24 1001 * To do this, we need to format the item, pin it in memory if required and a44f13edf0ebb4 Dave Chinner 2010-08-24 1002 * account for the space used by the transaction. Once we have done that we a44f13edf0ebb4 Dave Chinner 2010-08-24 1003 * need to release the unused reservation for the transaction, attach the a44f13edf0ebb4 Dave Chinner 2010-08-24 1004 * transaction to the checkpoint context so we carry the busy extents through a44f13edf0ebb4 Dave Chinner 2010-08-24 1005 * to checkpoint completion, and then unlock all the items in the transaction. a44f13edf0ebb4 Dave Chinner 2010-08-24 1006 * a44f13edf0ebb4 Dave Chinner 2010-08-24 1007 * Called with the context lock already held in read mode to lock out a44f13edf0ebb4 Dave Chinner 2010-08-24 1008 * background commit, returns without it held once background commits are a44f13edf0ebb4 Dave Chinner 2010-08-24 1009 * allowed again. a44f13edf0ebb4 Dave Chinner 2010-08-24 1010 */ c6f9726444c8f8 Jie Liu 2014-02-07 1011 void a44f13edf0ebb4 Dave Chinner 2010-08-24 1012 xfs_log_commit_cil( a44f13edf0ebb4 Dave Chinner 2010-08-24 1013 struct xfs_mount *mp, a44f13edf0ebb4 Dave Chinner 2010-08-24 1014 struct xfs_trans *tp, a44f13edf0ebb4 Dave Chinner 2010-08-24 1015 xfs_lsn_t *commit_lsn, 70393313dd0b26 Christoph Hellwig 2015-06-04 1016 bool regrant) a44f13edf0ebb4 Dave Chinner 2010-08-24 1017 { f7bdf03a99efc0 Mark Tinguely 2012-06-14 1018 struct xlog *log = mp->m_log; 991aaf65ff0add Dave Chinner 2013-08-12 1019 struct xfs_cil *cil = log->l_cilp; 195cd83d1b8835 Christoph Hellwig 2019-06-28 1020 struct xfs_log_item *lip, *next; f990fc5ad13b8f Shan Hai 2017-06-14 1021 xfs_lsn_t xc_commit_lsn; a44f13edf0ebb4 Dave Chinner 2010-08-24 1022 b1c5ebb21301fc Dave Chinner 2016-07-22 1023 /* b1c5ebb21301fc Dave Chinner 2016-07-22 1024 * Do all necessary memory allocation before we lock the CIL. b1c5ebb21301fc Dave Chinner 2016-07-22 1025 * This ensures the allocation does not deadlock with a CIL b1c5ebb21301fc Dave Chinner 2016-07-22 1026 * push in memory reclaim (e.g. from kswapd). b1c5ebb21301fc Dave Chinner 2016-07-22 1027 */ b1c5ebb21301fc Dave Chinner 2016-07-22 1028 xlog_cil_alloc_shadow_bufs(log, tp); b1c5ebb21301fc Dave Chinner 2016-07-22 1029 f5baac354db8b6 Dave Chinner 2013-08-12 1030 /* lock out background commit */ 991aaf65ff0add Dave Chinner 2013-08-12 1031 down_read(&cil->xc_ctx_lock); d1583a3833290a Dave Chinner 2010-09-24 1032 991aaf65ff0add Dave Chinner 2013-08-12 1033 xlog_cil_insert_items(log, tp); a44f13edf0ebb4 Dave Chinner 2010-08-24 1034 f990fc5ad13b8f Shan Hai 2017-06-14 1035 xc_commit_lsn = cil->xc_ctx->sequence; 991aaf65ff0add Dave Chinner 2013-08-12 1036 if (commit_lsn) f990fc5ad13b8f Shan Hai 2017-06-14 1037 *commit_lsn = xc_commit_lsn; a44f13edf0ebb4 Dave Chinner 2010-08-24 1038 8b41e3f98e6ca1 Christoph Hellwig 2020-03-25 1039 if (regrant && !XLOG_FORCED_SHUTDOWN(log)) 8b41e3f98e6ca1 Christoph Hellwig 2020-03-25 1040 xfs_log_ticket_regrant(log, tp->t_ticket); 8b41e3f98e6ca1 Christoph Hellwig 2020-03-25 1041 else 8b41e3f98e6ca1 Christoph Hellwig 2020-03-25 1042 xfs_log_ticket_ungrant(log, tp->t_ticket); ba18781b91569a Dave Chinner 2018-05-09 1043 tp->t_ticket = NULL; a44f13edf0ebb4 Dave Chinner 2010-08-24 1044 xfs_trans_unreserve_and_mod_sb(tp); a44f13edf0ebb4 Dave Chinner 2010-08-24 1045 a44f13edf0ebb4 Dave Chinner 2010-08-24 1046 /* a44f13edf0ebb4 Dave Chinner 2010-08-24 1047 * Once all the items of the transaction have been copied to the CIL, 195cd83d1b8835 Christoph Hellwig 2019-06-28 1048 * the items can be unlocked and possibly freed. a44f13edf0ebb4 Dave Chinner 2010-08-24 1049 * a44f13edf0ebb4 Dave Chinner 2010-08-24 1050 * This needs to be done before we drop the CIL context lock because we a44f13edf0ebb4 Dave Chinner 2010-08-24 1051 * have to update state in the log items and unlock them before they go a44f13edf0ebb4 Dave Chinner 2010-08-24 1052 * to disk. If we don't, then the CIL checkpoint can race with us and a44f13edf0ebb4 Dave Chinner 2010-08-24 1053 * we can run checkpoint completion before we've updated and unlocked a44f13edf0ebb4 Dave Chinner 2010-08-24 1054 * the log items. This affects (at least) processing of stale buffers, a44f13edf0ebb4 Dave Chinner 2010-08-24 1055 * inodes and EFIs. a44f13edf0ebb4 Dave Chinner 2010-08-24 1056 */ 195cd83d1b8835 Christoph Hellwig 2019-06-28 1057 trace_xfs_trans_commit_items(tp, _RET_IP_); 195cd83d1b8835 Christoph Hellwig 2019-06-28 1058 list_for_each_entry_safe(lip, next, &tp->t_items, li_trans) { 195cd83d1b8835 Christoph Hellwig 2019-06-28 1059 xfs_trans_del_item(lip); 195cd83d1b8835 Christoph Hellwig 2019-06-28 1060 if (lip->li_ops->iop_committing) 195cd83d1b8835 Christoph Hellwig 2019-06-28 1061 lip->li_ops->iop_committing(lip, xc_commit_lsn); 195cd83d1b8835 Christoph Hellwig 2019-06-28 1062 } a44f13edf0ebb4 Dave Chinner 2010-08-24 1063 0e7ab7efe77451 Dave Chinner 2020-03-24 1064 /* xlog_cil_push_background() releases cil->xc_ctx_lock */ 0e7ab7efe77451 Dave Chinner 2020-03-24 @1065 xlog_cil_push_background(log); a44f13edf0ebb4 Dave Chinner 2010-08-24 1066 } a44f13edf0ebb4 Dave Chinner 2010-08-24 1067 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org