aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/aoe
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block/aoe')
-rw-r--r--drivers/block/aoe/aoeblk.c9
-rw-r--r--drivers/block/aoe/aoechr.c10
2 files changed, 11 insertions, 8 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
diff --git a/drivers/block/aoe/aoechr.c b/drivers/block/aoe/aoechr.c
index 4a1b9e7464aa..146296ca4965 100644
--- a/drivers/block/aoe/aoechr.c
+++ b/drivers/block/aoe/aoechr.c
@@ -9,7 +9,7 @@
9#include <linux/completion.h> 9#include <linux/completion.h>
10#include <linux/delay.h> 10#include <linux/delay.h>
11#include <linux/slab.h> 11#include <linux/slab.h>
12#include <linux/smp_lock.h> 12#include <linux/mutex.h>
13#include <linux/skbuff.h> 13#include <linux/skbuff.h>
14#include "aoe.h" 14#include "aoe.h"
15 15
@@ -37,6 +37,7 @@ struct ErrMsg {
37 char *msg; 37 char *msg;
38}; 38};
39 39
40static DEFINE_MUTEX(aoechr_mutex);
40static struct ErrMsg emsgs[NMSG]; 41static struct ErrMsg emsgs[NMSG];
41static int emsgs_head_idx, emsgs_tail_idx; 42static int emsgs_head_idx, emsgs_tail_idx;
42static struct completion emsgs_comp; 43static struct completion emsgs_comp;
@@ -183,16 +184,16 @@ aoechr_open(struct inode *inode, struct file *filp)
183{ 184{
184 int n, i; 185 int n, i;
185 186
186 lock_kernel(); 187 mutex_lock(&aoechr_mutex);
187 n = iminor(inode); 188 n = iminor(inode);
188 filp->private_data = (void *) (unsigned long) n; 189 filp->private_data = (void *) (unsigned long) n;
189 190
190 for (i = 0; i < ARRAY_SIZE(chardevs); ++i) 191 for (i = 0; i < ARRAY_SIZE(chardevs); ++i)
191 if (chardevs[i].minor == n) { 192 if (chardevs[i].minor == n) {
192 unlock_kernel(); 193 mutex_unlock(&aoechr_mutex);
193 return 0; 194 return 0;
194 } 195 }
195 unlock_kernel(); 196 mutex_unlock(&aoechr_mutex);
196 return -EINVAL; 197 return -EINVAL;
197} 198}
198 199
@@ -265,6 +266,7 @@ static const struct file_operations aoe_fops = {
265 .open = aoechr_open, 266 .open = aoechr_open,
266 .release = aoechr_rel, 267 .release = aoechr_rel,
267 .owner = THIS_MODULE, 268 .owner = THIS_MODULE,
269 .llseek = noop_llseek,
268}; 270};
269 271
270static char *aoe_devnode(struct device *dev, mode_t *mode) 272static char *aoe_devnode(struct device *dev, mode_t *mode)