View difference between Paste ID: WrYisxi8 and
SHOW: | | - or go back to the newest paste.
1
root@furax # diff -upr a/linux/drivers/block/aoe/aoechr.c b/linux/drivers/block/aoe/aoechr.c
2
--- a/linux/drivers/block/aoe/aoechr.c	2011-11-07 16:29:39.000000000 +0100
3
+++ b/linux/drivers/block/aoe/aoechr.c	2011-11-07 16:29:39.000000000 +0100
4
@@ -8,8 +8,8 @@
5
 #include <linux/blkdev.h>
6
 #include <linux/init.h>
7
 #include <linux/delay.h>
8
-#include <linux/smp_lock.h>
9
 #include <linux/slab.h>
10
+#include <linux/mutex.h>
11
 #include "aoe.h"
12
 
13
 enum {
14
@@ -36,6 +36,8 @@ struct ErrMsg {
15
 	char *msg;
16
 };
17
 
18
+static DEFINE_MUTEX(aoechr_mutex);
19
+
20
 /* A ring buffer of error messages, to be read through
21
  * "/dev/etherd/err".  When no messages are present,
22
  * readers will block waiting for messages to appear.
23
@@ -182,16 +184,16 @@ aoechr_open(struct inode *inode, struct
24
 {
25
 	int n, i;
26
 
27
-	lock_kernel();
28
+	mutex_lock(&aoechr_mutex);
29
 	n = MINOR(inode->i_rdev);
30
 	filp->private_data = (void *) (unsigned long) n;
31
 
32
 	for (i = 0; i < ARRAY_SIZE(chardevs); ++i)
33
 		if (chardevs[i].minor == n) {
34
-			unlock_kernel();
35
+			mutex_unlock(&aoechr_mutex);
36
 			return 0;
37
 		}
38
-	unlock_kernel();
39
+	mutex_unlock(&aoechr_mutex);
40
 	return -EINVAL;
41
 }
42
43
44