lkml.org 
[lkml]   [2011]   [Jul]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] block: Check that queue is alive in blk_insert_cloned_request()
    On Jul 08 Roland Dreier wrote:
    > This fixes crashes such as the below that I see when the storage
    > underlying a dm-multipath device is hot-removed. The problem is that
    > dm requeues a request to a device whose block queue has already been
    > cleaned up, and blk_insert_cloned_request() doesn't check if the queue
    > is alive, but rather goes ahead and tries to queue the request. This
    > ends up dereferencing the elevator that was already freed in
    > blk_cleanup_queue().
    [...]
    > --- a/block/blk-core.c
    > +++ b/block/blk-core.c
    > @@ -1706,6 +1706,9 @@ int blk_insert_cloned_request(struct request_queue *q, struct request *rq)
    > return -EIO;
    > #endif
    >
    > + if (unlikely(test_bit(QUEUE_FLAG_DEAD, &q->queue_flags)))
    > + return -EIO;
    > +
    > spin_lock_irqsave(q->queue_lock, flags);
    >
    > /*

    Not knowing the calling contexts or having tried to learn about them, I am
    wondering: What prevents the elevator to be freed right after the flag
    was checked?
    --
    Stefan Richter
    -=====-==-== -=== -=--=
    http://arcgraph.de/sr/


    \
     
     \ /
      Last update: 2011-07-09 11:11    [W:0.021 / U:1.036 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site