diff options
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r-- | drivers/md/md.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 175c424f201f..7fc090ac9e28 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -1879,7 +1879,7 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev) | |||
1879 | rdev->sysfs_state = sysfs_get_dirent_safe(rdev->kobj.sd, "state"); | 1879 | rdev->sysfs_state = sysfs_get_dirent_safe(rdev->kobj.sd, "state"); |
1880 | 1880 | ||
1881 | list_add_rcu(&rdev->same_set, &mddev->disks); | 1881 | list_add_rcu(&rdev->same_set, &mddev->disks); |
1882 | bd_claim_by_disk(rdev->bdev, rdev->bdev->bd_holder, mddev->gendisk); | 1882 | bd_link_disk_holder(rdev->bdev, mddev->gendisk); |
1883 | 1883 | ||
1884 | /* May as well allow recovery to be retried once */ | 1884 | /* May as well allow recovery to be retried once */ |
1885 | mddev->recovery_disabled = 0; | 1885 | mddev->recovery_disabled = 0; |
@@ -1906,7 +1906,6 @@ static void unbind_rdev_from_array(mdk_rdev_t * rdev) | |||
1906 | MD_BUG(); | 1906 | MD_BUG(); |
1907 | return; | 1907 | return; |
1908 | } | 1908 | } |
1909 | bd_release_from_disk(rdev->bdev, rdev->mddev->gendisk); | ||
1910 | list_del_rcu(&rdev->same_set); | 1909 | list_del_rcu(&rdev->same_set); |
1911 | printk(KERN_INFO "md: unbind<%s>\n", bdevname(rdev->bdev,b)); | 1910 | printk(KERN_INFO "md: unbind<%s>\n", bdevname(rdev->bdev,b)); |
1912 | rdev->mddev = NULL; | 1911 | rdev->mddev = NULL; |
@@ -1934,19 +1933,13 @@ static int lock_rdev(mdk_rdev_t *rdev, dev_t dev, int shared) | |||
1934 | struct block_device *bdev; | 1933 | struct block_device *bdev; |
1935 | char b[BDEVNAME_SIZE]; | 1934 | char b[BDEVNAME_SIZE]; |
1936 | 1935 | ||
1937 | bdev = open_by_devnum(dev, FMODE_READ|FMODE_WRITE); | 1936 | bdev = blkdev_get_by_dev(dev, FMODE_READ|FMODE_WRITE|FMODE_EXCL, |
1937 | shared ? (mdk_rdev_t *)lock_rdev : rdev); | ||
1938 | if (IS_ERR(bdev)) { | 1938 | if (IS_ERR(bdev)) { |
1939 | printk(KERN_ERR "md: could not open %s.\n", | 1939 | printk(KERN_ERR "md: could not open %s.\n", |
1940 | __bdevname(dev, b)); | 1940 | __bdevname(dev, b)); |
1941 | return PTR_ERR(bdev); | 1941 | return PTR_ERR(bdev); |
1942 | } | 1942 | } |
1943 | err = bd_claim(bdev, shared ? (mdk_rdev_t *)lock_rdev : rdev); | ||
1944 | if (err) { | ||
1945 | printk(KERN_ERR "md: could not bd_claim %s.\n", | ||
1946 | bdevname(bdev, b)); | ||
1947 | blkdev_put(bdev, FMODE_READ|FMODE_WRITE); | ||
1948 | return err; | ||
1949 | } | ||
1950 | if (!shared) | 1943 | if (!shared) |
1951 | set_bit(AllReserved, &rdev->flags); | 1944 | set_bit(AllReserved, &rdev->flags); |
1952 | rdev->bdev = bdev; | 1945 | rdev->bdev = bdev; |
@@ -1959,8 +1952,7 @@ static void unlock_rdev(mdk_rdev_t *rdev) | |||
1959 | rdev->bdev = NULL; | 1952 | rdev->bdev = NULL; |
1960 | if (!bdev) | 1953 | if (!bdev) |
1961 | MD_BUG(); | 1954 | MD_BUG(); |
1962 | bd_release(bdev); | 1955 | blkdev_put(bdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL); |
1963 | blkdev_put(bdev, FMODE_READ|FMODE_WRITE); | ||
1964 | } | 1956 | } |
1965 | 1957 | ||
1966 | void md_autodetect_dev(dev_t dev); | 1958 | void md_autodetect_dev(dev_t dev); |