Re: Badness in local_bh_enable at kernel/softirq.c:140 with inet_stream

jordi Vaquero
2006-04-17T17:23:36Z

Hello,
First of all, thanks for reply me, but I'm so sorry I not understand
your advice. I'm trying to do a disk driver that connect with a server
using tcp/ip sockets.
I don't understand why the context is the problem I have.
I'm looking for it deeply and I find thaht local_bh_enable is used in
networks, scsi drivers for enable bottom halves.
Sorry if this its in FAQs, but I don't find it.
Thanks for advance
jordi

On 4/6/06, *linux-os (Dick Johnson)* <linux-os@analogic.com
<mailto:linux-os@analogic.com>> wrote:

On Thu, 6 Apr 2006, jordi Vaquero wrote:

> Hello
>
> I'm trying to make a Linux Kernel module. My module has a network
> comunication with sockets, I use the functions like this skeleton,
>
> sd = sock_create(AF_INET,SOCK_STREAM,IPPROTO_TCP,&sock);
> if(sd<0){
> printk(KERN_ERR "Error\n");
> }else{
> sout.sin_family = AF_INET;
> err = inet_aton("172.16.151.1
<http://172.16.151.1>",&sout.sin_addr); //this
> function works well, I implemented it.
> sout.sin_port = htons(20000);
> sd = sock->ops->connect(sock,(struct sockaddr*)&sout,
> sizeof(sout),O_RDWR);
> if(sd<0){
> printk(KERN_ERR "Error \n");
> sock_release(sock);
> }else{
> USE SENDMSG and RECVMSG
> ...
> ...
> ...
> sock_release(sock);
> }
>
> My problem is that sometimes, at some point near the connect
function, a
> warning is launched and dmesg shows this:
>
[SNIPPED... Crap]

This has become a FAQ...
If you need to do this INSIDE the kernel, you need to do it from
a kernel thread. Otherwise, your socket is indistinguishable
from somebody else's open file descriptor. A file descriptor needs
a CONTEXT! The kernel doesn't have a CONTEXT! You need a process
to have a context, either a kernel thread or a user-mode task.

Cheers,
Dick Johnson
Penguin : Linux version 2.6.15.4 <http://2.6.15.4> on an i686
machine (5589.42 BogoMips).
Warning : 98.36% of all statistics are fiction, book release in April.
_
\x1a\x04

****************************************************************
The information transmitted in this message is confidential and may
be privileged. Any review, retransmission, dissemination, or other
use of this information by persons or entities other than the
intended recipient is prohibited. If you are not the intended
recipient, please notify Analogic Corporation immediately - by
replying to this message or by sending an email to
DeliveryErrors@analogic.com <mailto:DeliveryErrors@analogic.com> -
and destroy all copies of this information, including any
attachments, without reading or disclosing them.

Thank you.