diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-22 13:49:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-22 13:49:54 -0400 |
commit | c37927d4359e81b85de644f8fb08878717cf5f3f (patch) | |
tree | 25dabf2d905e1410819d1bdaba0bf5f779100d3c /drivers/md/md.c | |
parent | 5704e44d283e907623e3775c1262f206a2c48cf3 (diff) | |
parent | 2a48fc0ab24241755dc93bfd4f01d68efab47f5a (diff) |
Merge branch 'trivial' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl
* 'trivial' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl:
block: autoconvert trivial BKL users to private mutex
drivers: autoconvert trivial BKL users to private mutex
ipmi: autoconvert trivial BKL users to private mutex
mac: autoconvert trivial BKL users to private mutex
mtd: autoconvert trivial BKL users to private mutex
scsi: autoconvert trivial BKL users to private mutex
Fix up trivial conflicts (due to addition of private mutex right next to
deletion of a version string) in drivers/char/pcmcia/cm40[04]0_cs.c
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r-- | drivers/md/md.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index f20d13e717d5..dbf822df942a 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -36,7 +36,7 @@ | |||
36 | #include <linux/blkdev.h> | 36 | #include <linux/blkdev.h> |
37 | #include <linux/sysctl.h> | 37 | #include <linux/sysctl.h> |
38 | #include <linux/seq_file.h> | 38 | #include <linux/seq_file.h> |
39 | #include <linux/smp_lock.h> | 39 | #include <linux/mutex.h> |
40 | #include <linux/buffer_head.h> /* for invalidate_bdev */ | 40 | #include <linux/buffer_head.h> /* for invalidate_bdev */ |
41 | #include <linux/poll.h> | 41 | #include <linux/poll.h> |
42 | #include <linux/ctype.h> | 42 | #include <linux/ctype.h> |
@@ -57,6 +57,7 @@ | |||
57 | #define DEBUG 0 | 57 | #define DEBUG 0 |
58 | #define dprintk(x...) ((void)(DEBUG && printk(x))) | 58 | #define dprintk(x...) ((void)(DEBUG && printk(x))) |
59 | 59 | ||
60 | static DEFINE_MUTEX(md_mutex); | ||
60 | 61 | ||
61 | #ifndef MODULE | 62 | #ifndef MODULE |
62 | static void autostart_arrays(int part); | 63 | static void autostart_arrays(int part); |
@@ -5951,7 +5952,7 @@ static int md_open(struct block_device *bdev, fmode_t mode) | |||
5951 | mddev_t *mddev = mddev_find(bdev->bd_dev); | 5952 | mddev_t *mddev = mddev_find(bdev->bd_dev); |
5952 | int err; | 5953 | int err; |
5953 | 5954 | ||
5954 | lock_kernel(); | 5955 | mutex_lock(&md_mutex); |
5955 | if (mddev->gendisk != bdev->bd_disk) { | 5956 | if (mddev->gendisk != bdev->bd_disk) { |
5956 | /* we are racing with mddev_put which is discarding this | 5957 | /* we are racing with mddev_put which is discarding this |
5957 | * bd_disk. | 5958 | * bd_disk. |
@@ -5960,7 +5961,7 @@ static int md_open(struct block_device *bdev, fmode_t mode) | |||
5960 | /* Wait until bdev->bd_disk is definitely gone */ | 5961 | /* Wait until bdev->bd_disk is definitely gone */ |
5961 | flush_scheduled_work(); | 5962 | flush_scheduled_work(); |
5962 | /* Then retry the open from the top */ | 5963 | /* Then retry the open from the top */ |
5963 | unlock_kernel(); | 5964 | mutex_unlock(&md_mutex); |
5964 | return -ERESTARTSYS; | 5965 | return -ERESTARTSYS; |
5965 | } | 5966 | } |
5966 | BUG_ON(mddev != bdev->bd_disk->private_data); | 5967 | BUG_ON(mddev != bdev->bd_disk->private_data); |
@@ -5974,7 +5975,7 @@ static int md_open(struct block_device *bdev, fmode_t mode) | |||
5974 | 5975 | ||
5975 | check_disk_size_change(mddev->gendisk, bdev); | 5976 | check_disk_size_change(mddev->gendisk, bdev); |
5976 | out: | 5977 | out: |
5977 | unlock_kernel(); | 5978 | mutex_unlock(&md_mutex); |
5978 | return err; | 5979 | return err; |
5979 | } | 5980 | } |
5980 | 5981 | ||
@@ -5983,10 +5984,10 @@ static int md_release(struct gendisk *disk, fmode_t mode) | |||
5983 | mddev_t *mddev = disk->private_data; | 5984 | mddev_t *mddev = disk->private_data; |
5984 | 5985 | ||
5985 | BUG_ON(!mddev); | 5986 | BUG_ON(!mddev); |
5986 | lock_kernel(); | 5987 | mutex_lock(&md_mutex); |
5987 | atomic_dec(&mddev->openers); | 5988 | atomic_dec(&mddev->openers); |
5988 | mddev_put(mddev); | 5989 | mddev_put(mddev); |
5989 | unlock_kernel(); | 5990 | mutex_unlock(&md_mutex); |
5990 | 5991 | ||
5991 | return 0; | 5992 | return 0; |
5992 | } | 5993 | } |