[linux-audio-dev] Re: [announce] [patch] Voluntary Kernel Preemption Patch

Ingo Molnar mingo at elte.hu
Mon Jul 19 06:20:30 EDT 2004


* Zwane Mwaikambo <zwane at linuxpower.ca> wrote:

> Looks like some of the voluntary preemption changes might need some
> eyeballing too. This appears to be a use after free, probably since we
> unlocked j_{list,state}_lock.

thx - this is the new __journal_clean_checkpoint_list() chunk:

--- linux/fs/jbd/checkpoint.c.orig	
+++ linux/fs/jbd/checkpoint.c	
@@ -465,6 +470,7 @@ int __journal_clean_checkpoint_list(jour
 	transaction_t *transaction, *last_transaction, *next_transaction;
 	int ret = 0;
 
+retry:
 	transaction = journal->j_checkpoint_transactions;
 	if (transaction == 0)
 		goto out;
@@ -487,6 +493,14 @@ int __journal_clean_checkpoint_list(jour
 				/* Use trylock because of the ranknig */
 				if (jbd_trylock_bh_state(jh2bh(jh)))
 					ret += __try_to_free_cp_buf(jh);
+				if (voluntary_need_resched()) {
+					spin_unlock(&journal->j_list_lock);
+					spin_unlock(&journal->j_state_lock);
+					voluntary_resched();
+					spin_lock(&journal->j_state_lock);
+					spin_lock(&journal->j_list_lock);
+					goto retry;
+				}
 			} while (jh != last_jh);
 		}
 	} while (transaction != last_transaction);


More information about the linux-audio-dev mailing list