aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJun'ichi Nomura <j-nomura@ce.jp.nec.com>2006-10-30 16:23:45 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-30 22:29:41 -0500
commitbcb55165d3d1ae3ec95807d118fd6d5956cd127b (patch)
tree9079f23a4893724a720c3dd0ce3051d476dff43e /fs
parenta7aacdf9ea45bf6139cfd750e558a3dcbc6f16c3 (diff)
[PATCH] fix bd_claim_by_kobject error handling
This fixes bd_claim_by_kobject to release bdev correctly in case that bd_claim succeeds but following add_bd_holder fails. Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/block_dev.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 702b88cbd91d..b54b0a1b7c68 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,
751 751
752 mutex_lock_nested(&bdev->bd_mutex, BD_MUTEX_PARTITION); 752 mutex_lock_nested(&bdev->bd_mutex, BD_MUTEX_PARTITION);
753 res = bd_claim(bdev, holder); 753 res = bd_claim(bdev, holder);
754 if (res == 0) 754 if (res == 0) {
755 res = add_bd_holder(bdev, bo); 755 res = add_bd_holder(bdev, bo);
756 if (res)
757 bd_release(bdev);
758 }
756 if (res) 759 if (res)
757 free_bd_holder(bo); 760 free_bd_holder(bo);
758 mutex_unlock(&bdev->bd_mutex); 761 mutex_unlock(&bdev->bd_mutex);