diff options
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r-- | drivers/md/md.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 147efcb1e8ca..c9c9c096ad80 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include <linux/buffer_head.h> /* for invalidate_bdev */ | 43 | #include <linux/buffer_head.h> /* for invalidate_bdev */ |
44 | #include <linux/suspend.h> | 44 | #include <linux/suspend.h> |
45 | #include <linux/poll.h> | 45 | #include <linux/poll.h> |
46 | #include <linux/mutex.h> | ||
46 | 47 | ||
47 | #include <linux/init.h> | 48 | #include <linux/init.h> |
48 | 49 | ||
@@ -2500,7 +2501,7 @@ int mdp_major = 0; | |||
2500 | 2501 | ||
2501 | static struct kobject *md_probe(dev_t dev, int *part, void *data) | 2502 | static struct kobject *md_probe(dev_t dev, int *part, void *data) |
2502 | { | 2503 | { |
2503 | static DECLARE_MUTEX(disks_sem); | 2504 | static DEFINE_MUTEX(disks_mutex); |
2504 | mddev_t *mddev = mddev_find(dev); | 2505 | mddev_t *mddev = mddev_find(dev); |
2505 | struct gendisk *disk; | 2506 | struct gendisk *disk; |
2506 | int partitioned = (MAJOR(dev) != MD_MAJOR); | 2507 | int partitioned = (MAJOR(dev) != MD_MAJOR); |
@@ -2510,15 +2511,15 @@ static struct kobject *md_probe(dev_t dev, int *part, void *data) | |||
2510 | if (!mddev) | 2511 | if (!mddev) |
2511 | return NULL; | 2512 | return NULL; |
2512 | 2513 | ||
2513 | down(&disks_sem); | 2514 | mutex_lock(&disks_mutex); |
2514 | if (mddev->gendisk) { | 2515 | if (mddev->gendisk) { |
2515 | up(&disks_sem); | 2516 | mutex_unlock(&disks_mutex); |
2516 | mddev_put(mddev); | 2517 | mddev_put(mddev); |
2517 | return NULL; | 2518 | return NULL; |
2518 | } | 2519 | } |
2519 | disk = alloc_disk(1 << shift); | 2520 | disk = alloc_disk(1 << shift); |
2520 | if (!disk) { | 2521 | if (!disk) { |
2521 | up(&disks_sem); | 2522 | mutex_unlock(&disks_mutex); |
2522 | mddev_put(mddev); | 2523 | mddev_put(mddev); |
2523 | return NULL; | 2524 | return NULL; |
2524 | } | 2525 | } |
@@ -2536,7 +2537,7 @@ static struct kobject *md_probe(dev_t dev, int *part, void *data) | |||
2536 | disk->queue = mddev->queue; | 2537 | disk->queue = mddev->queue; |
2537 | add_disk(disk); | 2538 | add_disk(disk); |
2538 | mddev->gendisk = disk; | 2539 | mddev->gendisk = disk; |
2539 | up(&disks_sem); | 2540 | mutex_unlock(&disks_mutex); |
2540 | mddev->kobj.parent = &disk->kobj; | 2541 | mddev->kobj.parent = &disk->kobj; |
2541 | mddev->kobj.k_name = NULL; | 2542 | mddev->kobj.k_name = NULL; |
2542 | snprintf(mddev->kobj.name, KOBJ_NAME_LEN, "%s", "md"); | 2543 | snprintf(mddev->kobj.name, KOBJ_NAME_LEN, "%s", "md"); |