Skip to content

Commit 05d5233

Browse files
committed
jbd2: fix up sparse warnings in checkpoint code
Add missing __acquires() and __releases() annotations. Also, in an "this should never happen" WARN_ON check, if it *does* actually happen, we need to release j_state_lock since this function is always supposed to release that lock. Otherwise, things will quickly grind to a halt after the WARN_ON trips. Fixes: 96f1e09 ("jbd2: avoid long hold times of j_state_lock...") Cc: stable@kernel.org Signed-off-by: Theodore Ts'o <tytso@mit.edu>
1 parent fa329e2 commit 05d5233

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

fs/jbd2/checkpoint.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ static int __try_to_free_cp_buf(struct journal_head *jh)
106106
* for a checkpoint to free up some space in the log.
107107
*/
108108
void __jbd2_log_wait_for_space(journal_t *journal)
109+
__acquires(&journal->j_state_lock)
110+
__releases(&journal->j_state_lock)
109111
{
110112
int nblocks, space_left;
111113
/* assert_spin_locked(&journal->j_state_lock); */

fs/jbd2/transaction.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,10 @@ static void wait_transaction_switching(journal_t *journal)
195195
DEFINE_WAIT(wait);
196196

197197
if (WARN_ON(!journal->j_running_transaction ||
198-
journal->j_running_transaction->t_state != T_SWITCH))
198+
journal->j_running_transaction->t_state != T_SWITCH)) {
199+
read_unlock(&journal->j_state_lock);
199200
return;
201+
}
200202
prepare_to_wait(&journal->j_wait_transaction_locked, &wait,
201203
TASK_UNINTERRUPTIBLE);
202204
read_unlock(&journal->j_state_lock);

0 commit comments

Comments
 (0)