Skip to contentSkip to conversation

fs/xfs/xfs_log_recover.c:2629 xlog_recover_process_intents() error: uninitialized symbol 'error'.

PATCH New Dan Carpenter 1 participant 1 message Jun 23, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 5/25 fs/xfs/xfs_log_recover.c:2629 xlog_recover_process_intents() error: uninitialized symbol 'error'.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git scrub-rtsummary
head:   6a3195f0b8086aa941c656f91b7a0498e15aad0d
commit: 89406a23131bc5814e774e809cee961984444e48 [5/25] xfs: proper replay of deferred ops queued during log recovery
config: openrisc-randconfig-m031-20200623 (attached as .config)
compiler: or1k-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate

New smatch warnings:
fs/xfs/xfs_log_recover.c:2629 xlog_recover_process_intents() error: uninitialized symbol 'error'.

# https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git/commit/?id=89406a23131bc5814e774e809cee961984444e48
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 89406a23131bc5814e774e809cee961984444e48
vim +/error +2629 fs/xfs/xfs_log_recover.c

^1da177e4c3f41 Linus Torvalds  2005-04-16  2587  
a9c21c1b9deace David Chinner   2008-10-30  2588  	ailp = log->l_ailp;
57e809561118a4 Matthew Wilcox  2018-03-07  2589  	spin_lock(&ailp->ail_lock);
a9c21c1b9deace David Chinner   2008-10-30  2590  	lip = xfs_trans_ail_cursor_first(ailp, &cur, 0);
7bf7a193a90cad Darrick J. Wong 2017-08-31  2591  #if defined(DEBUG) || defined(XFS_WARN)
dc42375d5f55d2 Darrick J. Wong 2016-08-03  2592  	last_lsn = xlog_assign_lsn(log->l_curr_cycle, log->l_curr_block);
7bf7a193a90cad Darrick J. Wong 2017-08-31  2593  #endif
^1da177e4c3f41 Linus Torvalds  2005-04-16  2594  	while (lip != NULL) {
^1da177e4c3f41 Linus Torvalds  2005-04-16  2595  		/*
dc42375d5f55d2 Darrick J. Wong 2016-08-03  2596  		 * We're done when we see something other than an intent.
dc42375d5f55d2 Darrick J. Wong 2016-08-03  2597  		 * There should be no intents left in the AIL now.
^1da177e4c3f41 Linus Torvalds  2005-04-16  2598  		 */
dc42375d5f55d2 Darrick J. Wong 2016-08-03  2599  		if (!xlog_item_is_intent(lip)) {
27d8d5fe0ef9da David Chinner   2008-10-30  2600  #ifdef DEBUG
a9c21c1b9deace David Chinner   2008-10-30  2601  			for (; lip; lip = xfs_trans_ail_cursor_next(ailp, &cur))
dc42375d5f55d2 Darrick J. Wong 2016-08-03  2602  				ASSERT(!xlog_item_is_intent(lip));
27d8d5fe0ef9da David Chinner   2008-10-30  2603  #endif
^1da177e4c3f41 Linus Torvalds  2005-04-16  2604  			break;
^1da177e4c3f41 Linus Torvalds  2005-04-16  2605  		}
^1da177e4c3f41 Linus Torvalds  2005-04-16  2606  
^1da177e4c3f41 Linus Torvalds  2005-04-16  2607  		/*
dc42375d5f55d2 Darrick J. Wong 2016-08-03  2608  		 * We should never see a redo item with a LSN higher than
dc42375d5f55d2 Darrick J. Wong 2016-08-03  2609  		 * the last transaction we found in the log at the start
dc42375d5f55d2 Darrick J. Wong 2016-08-03  2610  		 * of recovery.
^1da177e4c3f41 Linus Torvalds  2005-04-16  2611  		 */
dc42375d5f55d2 Darrick J. Wong 2016-08-03  2612  		ASSERT(XFS_LSN_CMP(last_lsn, lip->li_lsn) >= 0);
^1da177e4c3f41 Linus Torvalds  2005-04-16  2613  
509955823cc9cc Darrick J. Wong 2017-11-21  2614  		/*
509955823cc9cc Darrick J. Wong 2017-11-21  2615  		 * NOTE: If your intent processing routine can create more
89406a23131bc5 Darrick J. Wong 2020-05-15  2616  		 * deferred ops, you /must/ attach them to the freezer in
9329ba89cbb1f2 Darrick J. Wong 2020-05-01  2617  		 * this routine or else those subsequent intents will get
509955823cc9cc Darrick J. Wong 2017-11-21  2618  		 * replayed in the wrong order!
509955823cc9cc Darrick J. Wong 2017-11-21  2619  		 */
cc560a5a9540be Darrick J. Wong 2020-05-01  2620  		if (!test_and_set_bit(XFS_LI_RECOVERED, &lip->li_flags)) {
96b60f82671376 Darrick J. Wong 2020-05-01  2621  			spin_unlock(&ailp->ail_lock);
89406a23131bc5 Darrick J. Wong 2020-05-15  2622  			error = lip->li_ops->iop_recover(lip, &freezer);
                                                                        ^^^^^^^^

"error" is not initialized if the bit is set.

96b60f82671376 Darrick J. Wong 2020-05-01  2623  			spin_lock(&ailp->ail_lock);
96b60f82671376 Darrick J. Wong 2020-05-01  2624  		}
89406a23131bc5 Darrick J. Wong 2020-05-15  2625  		if (freezer) {
89406a23131bc5 Darrick J. Wong 2020-05-15  2626  			list_add_tail(&freezer->dfc_list, &dfops_freezers);
89406a23131bc5 Darrick J. Wong 2020-05-15  2627  			freezer = NULL;
89406a23131bc5 Darrick J. Wong 2020-05-15  2628  		}
27d8d5fe0ef9da David Chinner   2008-10-30 @2629  		if (error)
                                                                    ^^^^^
89406a23131bc5 Darrick J. Wong 2020-05-15  2630  			break;
89406a23131bc5 Darrick J. Wong 2020-05-15  2631  
a9c21c1b9deace David Chinner   2008-10-30  2632  		lip = xfs_trans_ail_cursor_next(ailp, &cur);
^1da177e4c3f41 Linus Torvalds  2005-04-16  2633  	}
89406a23131bc5 Darrick J. Wong 2020-05-15  2634  
e4a1e29cb0ace3 Eric Sandeen    2014-04-14  2635  	xfs_trans_ail_cursor_done(&cur);
57e809561118a4 Matthew Wilcox  2018-03-07  2636  	spin_unlock(&ailp->ail_lock);
fbfa977d25dc8d Brian Foster    2018-08-01  2637  	if (!error)
89406a23131bc5 Darrick J. Wong 2020-05-15  2638  		error = xlog_finish_defer_ops(log->l_mp, &dfops_freezers);
509955823cc9cc Darrick J. Wong 2017-11-21  2639  
89406a23131bc5 Darrick J. Wong 2020-05-15  2640  	xlog_cancel_defer_ops(log->l_mp, &dfops_freezers);
3c1e2bbe5bcdcd David Chinner   2008-04-10  2641  	return error;
^1da177e4c3f41 Linus Torvalds  2005-04-16  2642  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org