corruption with mtdblock
Nicolas Pitre
nico at cam.org
Thu Nov 9 09:34:21 EST 2000
On Thu, 9 Nov 2000, David Woodhouse wrote:
>
> 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;
> }
Yep! This way there is no opened window between the two QUEUE_EMPTY
tests which is clearer.
Nicolas
To unsubscribe, send "unsubscribe mtd" to majordomo at infradead.org
More information about the linux-mtd
mailing list