Skip to contentSkip to conversation

dm thin: inverted down_trylock() test

PATCH In review Dan Carpenter 2 participants 2 messages Feb 25, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dm thin: inverted down_trylock() test

down_trylock() is the opposite of mutex_trylock(). It returns zero on success and one on failure.

Fixes f4ef95631ebf ('dm thin: do not run the worker thread if pool is suspended')
drivers/md/dm-thin.c +1 -1
index 6cbe9d2e0385..7d8e03c21fa9 100644
@@ -237,7 +237,7 @@ struct thin_c {
  */
 static void wake_worker(struct pool *pool)
 {
-	if (down_trylock(&pool->queue_work_lock)) {
+	if (!down_trylock(&pool->queue_work_lock)) {
 		queue_work(pool->wq, &pool->worker);
 		up(&pool->queue_work_lock);
 	}
#1 lore raw
Quoted 5 lines · Dan Carpenter

down_trylock() is the opposite of mutex_trylock(). It returns zero on success and one on failure.

Fixes f4ef95631ebf ('dm thin: do not run the worker thread if pool is suspended')

Thanks for the fix, but that commit has since been dropped.