lkml.org 
[lkml]   [1996]   [Jul]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectFix for loop device deadlock.
I finally found & fixed the deadlock with the loop device, which
I have been hunting ever since about 1.3.86.
There were actually three (maybe four) deadly embraces,
and this patch fixes (nearly) all of them.
These patches are against 2.0.6
(I sent the patches only to Linus.)

CONDITIONS:
* User pgm invokes getblk/ll_rw_blk, for the loop device, which in turn
calls getblk for the "real" device.

DEADLOCKS:
1) While the loop driver is processing an I/O request, it calls getblk,
which eventually calls wakeup_bdflush(with wait == 1). bdflush calls
ll_rw_blk for the loop device. This I/O request gets put on the queue, but
can't be processed until the current one completes. Now bdflush and the
appl pgm are each waiting for the other to finish. Deadly embrace!
FIXED.

2) Same as above, but all the request blocks are busy, so in
get_request_wait,
bdflush keeps waiting for one to be free'd. Which won't happen.
Deadly embrace!
FIXED.

3) Loop device uses up all the allowed request blocks, so when it is
necessary to allocate one for the real device, it can't be done.
FIXED. By cutting max_req in half for LOOP_MAJOR.

4) bdflush wakes up. bdflush calls ll_rw_blk for the loop device.
This calls do_lo_request, which calls getblk......eventually calls
wakeup_bdflush(with wait == 1). So bdflush wakes up bdflush, then
waits for it to finish.
Suicide!
CHECKED FOR. MAYBE FIXED, MAYBE NOT.

5) All the bh's are occupied by LOOP device blocks. When something (bdflush
or loop-driver) needs to get a bh for the "real" device, it can't.
NOT FIXED. I'm still working on this.

HELP!!!!!!! I think the way to fix this is to only allow half of the bh's
be usable for loop device blocks. ANy suggestions/hints on this?
I can figure out the first part (only let it grab every other bh), but
how to handle failure--when there really ARE more bh's around, just none
that can be used on the current (loop) request?
The code under "refill_freelist" (fs/buffer.c) is hard to follow.


Regards,
Ray Van Tassle
rayvt@comm.mot.com


\
 
 \ /
  Last update: 2005-03-22 13:37    [W:0.045 / U:0.192 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site