[lkml]   [2010]   [Aug]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Patch in this message
    Subject[PATCH RESEND block#for-2.6.36] block_dev: always serialize exclusive open attempts
    bd_prepare_to_claim() incorrectly allowed multiple attempts for
    exclusive open to progress in parallel if the attempting holders are
    identical. This triggered BUG_ON() as reported in the following bug.

    __bd_abort_claiming() is used to finish claiming blocks and doesn't
    work if multiple openers are inside a claiming block. Allowing
    multiple parallel open attempts to continue doesn't gain anything as
    those are serialized down in the call chain anyway. Fix it by always
    allowing only single open attempt in a claiming block.

    This problem can easily be reproduced by adding a delay after
    bd_prepare_to_claim() and attempting to mount two partitions of a

    stable: only applicable to v2.6.35

    Signed-off-by: Tejun Heo <>
    Reported-by: Markus Trippelsdorf <>
    Oops, had the wrong reported-by credit. Updated.


    fs/block_dev.c | 4 ++--
    1 file changed, 2 insertions(+), 2 deletions(-)

    diff --git a/fs/block_dev.c b/fs/block_dev.c
    index 99d6af8..b3171fb 100644
    --- a/fs/block_dev.c
    +++ b/fs/block_dev.c
    @@ -681,8 +681,8 @@ retry:
    if (!bd_may_claim(bdev, whole, holder))
    return -EBUSY;

    - /* if someone else is claiming, wait for it to finish */
    - if (whole->bd_claiming && whole->bd_claiming != holder) {
    + /* if claiming is already in progress, wait for it to finish */
    + if (whole->bd_claiming) {
    wait_queue_head_t *wq = bit_waitqueue(&whole->bd_claiming, 0);

     \ /
      Last update: 2010-08-04 18:01    [W:0.026 / U:23.244 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site