corruption with mtdblock

David Woodhouse dwmw2 at infradead.org
Thu Nov 9 03:12:19 EST 2000


Upon further consideration, it may be cleaner (at the cost of _slightly_
higher io_request_lock contention) just to _not_ drop the spinlock between
finishing one request and checking to see if the queue is empty.

How about this?

 	exit_sighand(tsk);
 	exit_fs(tsk);
 
+	spin_lock_irq(&io_request_lock);
 	while (!leaving) {
 		add_wait_queue(&thr_wq, &wait);
 		set_current_state(TASK_INTERRUPTIBLE);
-		spin_lock_irq(&io_request_lock);
 		if (QUEUE_EMPTY) {
 			spin_unlock_irq(&io_request_lock);
 			schedule();
 			remove_wait_queue(&thr_wq, &wait); 
+			spin_lock_irq(&io_request_lock);
 		} else {
 			remove_wait_queue(&thr_wq, &wait); 
 			set_current_state(TASK_RUNNING);
 			handle_mtdblock_request();
-			spin_unlock_irq(&io_request_lock);
 		}
 	}
+	spin_unlock_irq(&io_request_lock);
 	up(&thread_sem);
 	return 0;
 }


-- 
dwmw2




To unsubscribe, send "unsubscribe mtd" to majordomo at infradead.org



More information about the linux-mtd mailing list