Re: BKL still required for what functions?
From: Richard Holden
Date: Tue Oct 07 2008 - 13:55:43 EST
On Oct 7, 2008, at 10:35 AM, Alan Cox wrote:
Its never so simple - a lot of the functions it depends what data
you are
using or passing to them whether they are BKL safe.
Which bits use the BKL and what do you need to know is safe ?
Actually, it looks like I was looking at 2 different places, the
simple removal is in phonedev.c that you authored, as far as I can
tell the only thing the BKL is protecting is a call to request_module,
it may be some nesting rules that I don't understand but I think if it
is still needed there we could push the lock_kernel call down to the
site of the request_module call. See patch below.
Thanks,
Richard Holden
Signed-off-by: Richard Holden <aciddeath@xxxxxxxxx>
diff --git a/drivers/telephony/phonedev.c b/drivers/telephony/phonedev.c
index 4d74ba3..fd1424c 100644
--- a/drivers/telephony/phonedev.c
+++ b/drivers/telephony/phonedev.c
@@ -54,14 +54,16 @@ static int phone_open(struct inode *inode, struct
file *file)
if (minor >= PHONE_NUM_DEVICES)
return -ENODEV;
- lock_kernel();
+
mutex_lock(&phone_lock);
p = phone_device[minor];
if (p)
new_fops = fops_get(p->f_op);
if (!new_fops) {
mutex_unlock(&phone_lock);
+ lock_kernel();
request_module("char-major-%d-%d", PHONE_MAJOR, minor);
+ unlock_kernel();
mutex_lock(&phone_lock);
p = phone_device[minor];
if (p == NULL || (new_fops = fops_get(p->f_op)) == NULL)
@@ -81,7 +83,6 @@ static int phone_open(struct inode *inode, struct
file *file)
fops_put(old_fops);
end:
mutex_unlock(&phone_lock);
- unlock_kernel();
return err;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/