Messages in this thread Patch in this message |  | | Date | Tue, 22 Aug 2000 13:54:46 +0200 | From | Jens Axboe <> | Subject | Re: Ramdisk / sync deadlock |
| |
On Tue, Aug 22 2000, Daniel Moore wrote: > System: SGI 1400 SMP w/ sym53c8xx SCSI. > Kernel: 2.4.0-test5 > > I've been hitting a SMP deadlock caused by creating traffic > on a ramdisk at the same time as syncing. The backtraces show > the locks causing the deadlock. I don't know how to fix this > one myself, so here's the info in case it helps...
This patch should fix it, rd does not need to hold the io_request_lock all through the request fn.
-- * Jens Axboe <axboe@suse.de> * SuSE Labs --- /opt/kernel/linux-2.4.0-test7-pre6/drivers/block/rd.c Thu Jul 13 06:58:42 2000 +++ drivers/block/rd.c Tue Aug 22 13:52:52 2000 @@ -203,10 +203,12 @@ repeat: INIT_REQUEST; + spin_unlock_irq(&io_request_lock); minor = MINOR(CURRENT->rq_dev); if (minor >= NUM_RAMDISKS) { + spin_lock_irq(&io_request_lock); end_request(0); goto repeat; } @@ -215,12 +217,14 @@ len = CURRENT->current_nr_sectors << 9; if ((offset + len) > rd_length[minor]) { + spin_lock_irq(&io_request_lock); end_request(0); goto repeat; } if ((CURRENT->cmd != READ) && (CURRENT->cmd != WRITE)) { printk(KERN_INFO "RAMDISK: bad command: %d\n", CURRENT->cmd); + spin_lock_irq(&io_request_lock); end_request(0); goto repeat; } @@ -236,6 +240,7 @@ mark_buffer_protected(rbh); brelse(rbh); + spin_lock_irq(&io_request_lock); end_request(1); goto repeat; } |  |