lkml.org 
[lkml]   [2000]   [Aug]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: 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;
}
\
 
 \ /
  Last update: 2005-03-22 12:37    [W:0.033 / U:0.272 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site