root@furax # diff -upr a/linux/drivers/block/aoe/aoechr.c b/linux/drivers/block/aoe/aoechr.c --- a/linux/drivers/block/aoe/aoechr.c 2011-11-07 16:29:39.000000000 +0100 +++ b/linux/drivers/block/aoe/aoechr.c 2011-11-07 16:29:39.000000000 +0100 @@ -8,8 +8,8 @@ #include #include #include -#include #include +#include #include "aoe.h" enum { @@ -36,6 +36,8 @@ struct ErrMsg { char *msg; }; +static DEFINE_MUTEX(aoechr_mutex); + /* A ring buffer of error messages, to be read through * "/dev/etherd/err". When no messages are present, * readers will block waiting for messages to appear. @@ -182,16 +184,16 @@ aoechr_open(struct inode *inode, struct { int n, i; - lock_kernel(); + mutex_lock(&aoechr_mutex); n = MINOR(inode->i_rdev); filp->private_data = (void *) (unsigned long) n; for (i = 0; i < ARRAY_SIZE(chardevs); ++i) if (chardevs[i].minor == n) { - unlock_kernel(); + mutex_unlock(&aoechr_mutex); return 0; } - unlock_kernel(); + mutex_unlock(&aoechr_mutex); return -EINVAL; }