diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/block_dev.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c index 702b88cbd91..b54b0a1b7c6 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -751,8 +751,11 @@ static int bd_claim_by_kobject(struct block_device *bdev, void *holder, mutex_lock_nested(&bdev->bd_mutex, BD_MUTEX_PARTITION); res = bd_claim(bdev, holder); - if (res == 0) + if (res == 0) { res = add_bd_holder(bdev, bo); + if (res) + bd_release(bdev); + } if (res) free_bd_holder(bo); mutex_unlock(&bdev->bd_mutex); |