aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/aoe/aoeblk.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block/aoe/aoeblk.c')
-rw-r--r--drivers/block/aoe/aoeblk.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c
index a946929735a5..f21c237a9e5e 100644
--- a/drivers/block/aoe/aoeblk.c
+++ b/drivers/block/aoe/aoeblk.c
@@ -12,9 +12,10 @@
12#include <linux/slab.h> 12#include <linux/slab.h>
13#include <linux/genhd.h> 13#include <linux/genhd.h>
14#include <linux/netdevice.h> 14#include <linux/netdevice.h>
15#include <linux/smp_lock.h> 15#include <linux/mutex.h>
16#include "aoe.h" 16#include "aoe.h"
17 17
18static DEFINE_MUTEX(aoeblk_mutex);
18static struct kmem_cache *buf_pool_cache; 19static struct kmem_cache *buf_pool_cache;
19 20
20static ssize_t aoedisk_show_state(struct device *dev, 21static ssize_t aoedisk_show_state(struct device *dev,
@@ -125,16 +126,16 @@ aoeblk_open(struct block_device *bdev, fmode_t mode)
125 struct aoedev *d = bdev->bd_disk->private_data; 126 struct aoedev *d = bdev->bd_disk->private_data;
126 ulong flags; 127 ulong flags;
127 128
128 lock_kernel(); 129 mutex_lock(&aoeblk_mutex);
129 spin_lock_irqsave(&d->lock, flags); 130 spin_lock_irqsave(&d->lock, flags);
130 if (d->flags & DEVFL_UP) { 131 if (d->flags & DEVFL_UP) {
131 d->nopen++; 132 d->nopen++;
132 spin_unlock_irqrestore(&d->lock, flags); 133 spin_unlock_irqrestore(&d->lock, flags);
133 unlock_kernel(); 134 mutex_unlock(&aoeblk_mutex);
134 return 0; 135 return 0;
135 } 136 }
136 spin_unlock_irqrestore(&d->lock, flags); 137 spin_unlock_irqrestore(&d->lock, flags);
137 unlock_kernel(); 138 mutex_unlock(&aoeblk_mutex);
138 return -ENODEV; 139 return -ENODEV;
139} 140}
140 141