* lock_kernel twice possible ?
@ 2005-10-15 7:04 li nux
2005-10-15 7:33 ` Coywolf Qi Hunt
0 siblings, 1 reply; 7+ messages in thread
From: li nux @ 2005-10-15 7:04 UTC (permalink / raw)
To: linux
Hi,
I was going thru the NFS v3 code for SMP kernel 2.6.11
to see how an inode gets revalidated. I found that
there is a possibility that there may be an attempt to
do lock_kernel() twice.
Is this possible ? If yes then how this deadlock
condition is/can be avoided.
-lnxluv
Below is the code flow (please see ** for
lock_kernel):
nfs_revalidate_inode
- __nfs_revalidate_inode
- ** lock_kernel() **
- nfs_wait_on_inode
- Call getattr() (which is nfs3_proc_getattr()) to
get the attributes from the server and
refresh the inode with the new values
- IF the cached data is invalid for the inode
- Writeback (If dirty) and sync the
inode, call nfs_wb_all
- nfs_wb_all
- nfs_sync_inode
- call nfs_wait_on_requests to wait for
the requests associated with the pages
to get complete
- nfs_flush_inode
- nfs_scan_dirty
- nfs_flush_list
- nfs_flush_one
- nfs_write_rpcsetup
- nfs3_proc_write_setup
- rpc_init_task
- rpc_call_setup
- nfs_execute_write
- ** lock_kernel() **
- rpc_execute
- ** unlock_kernel() **
- ** unlock_kernel() **
__________________________________
Yahoo! Music Unlimited
Access over 1 million songs. Try it free.
http://music.yahoo.com/unlimited/
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: lock_kernel twice possible ?
2005-10-15 7:04 lock_kernel twice possible ? li nux
@ 2005-10-15 7:33 ` Coywolf Qi Hunt
2005-10-15 7:38 ` li nux
0 siblings, 1 reply; 7+ messages in thread
From: Coywolf Qi Hunt @ 2005-10-15 7:33 UTC (permalink / raw)
To: li nux; +Cc: linux
On 10/15/05, li nux <lnxluv@yahoo.com> wrote:
> Hi,
>
> I was going thru the NFS v3 code for SMP kernel 2.6.11
> to see how an inode gets revalidated. I found that
> there is a possibility that there may be an attempt to
> do lock_kernel() twice.
>
> Is this possible ? If yes then how this deadlock
> condition is/can be avoided.
The BKL is recursive!
--
Coywolf Qi Hunt
http://sosdg.org/~coywolf/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: lock_kernel twice possible ?
2005-10-15 7:33 ` Coywolf Qi Hunt
@ 2005-10-15 7:38 ` li nux
2005-10-15 7:47 ` Coywolf Qi Hunt
2005-10-15 7:58 ` Mitchell Blank Jr
0 siblings, 2 replies; 7+ messages in thread
From: li nux @ 2005-10-15 7:38 UTC (permalink / raw)
To: Coywolf Qi Hunt; +Cc: linux
Sorry, couldn't get what you want to say.
Can you please elaborate.
--- Coywolf Qi Hunt <coywolf@gmail.com> wrote:
> On 10/15/05, li nux <lnxluv@yahoo.com> wrote:
> > Hi,
> >
> > I was going thru the NFS v3 code for SMP kernel
> 2.6.11
> > to see how an inode gets revalidated. I found that
> > there is a possibility that there may be an
> attempt to
> > do lock_kernel() twice.
> >
> > Is this possible ? If yes then how this deadlock
> > condition is/can be avoided.
>
> The BKL is recursive!
> --
> Coywolf Qi Hunt
> http://sosdg.org/~coywolf/
>
__________________________________
Yahoo! Music Unlimited
Access over 1 million songs. Try it free.
http://music.yahoo.com/unlimited/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: lock_kernel twice possible ?
2005-10-15 7:38 ` li nux
@ 2005-10-15 7:47 ` Coywolf Qi Hunt
2005-10-19 21:29 ` Bill Davidsen
2005-10-15 7:58 ` Mitchell Blank Jr
1 sibling, 1 reply; 7+ messages in thread
From: Coywolf Qi Hunt @ 2005-10-15 7:47 UTC (permalink / raw)
To: li nux; +Cc: linux
On 10/15/05, li nux <lnxluv@yahoo.com> wrote:
> Sorry, couldn't get what you want to say.
> Can you please elaborate.
http://www.zipworld.com.au/~akpm/linux/patches/stuff/top-posting.txt
http://www.catb.org/~esr/jargon/html/T/top-post.html
--
Coywolf Qi Hunt
http://sosdg.org/~coywolf/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: lock_kernel twice possible ?
2005-10-15 7:47 ` Coywolf Qi Hunt
@ 2005-10-19 21:29 ` Bill Davidsen
2005-10-20 7:00 ` Steven Rostedt
0 siblings, 1 reply; 7+ messages in thread
From: Bill Davidsen @ 2005-10-19 21:29 UTC (permalink / raw)
To: Coywolf Qi Hunt; +Cc: linux
Coywolf Qi Hunt wrote:
> On 10/15/05, li nux <lnxluv@yahoo.com> wrote:
>
>>Sorry, couldn't get what you want to say.
>>Can you please elaborate.
>
>
> http://www.zipworld.com.au/~akpm/linux/patches/stuff/top-posting.txt
> http://www.catb.org/~esr/jargon/html/T/top-post.html
The whole post fit on one screen and he was not continuing the
conversation, he was commenting on your post as a whole. I think you're
being a bit pedantic here.
I don't think his reply failed your criteria, it wasn't overlong, it
didn't break a flowing discussion, and no backward reading was required.
~~~~~~~
Q: Why is top-posting evil?
A1: Because top-posters tend to leave the entirety of the email to which
they are replying intact, so the email gets too long.
A2: Because we prefer to use bottom-posting, and it is *extremely* hard to
maintain a coherently flowing email conversation when some of the
participants are bottom-posting and some are top-posting.
A3: backwards read don't humans because
--
-bill davidsen (davidsen@tmr.com)
"The secret to procrastination is to put things off until the
last possible moment - but no longer" -me
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: lock_kernel twice possible ?
2005-10-19 21:29 ` Bill Davidsen
@ 2005-10-20 7:00 ` Steven Rostedt
0 siblings, 0 replies; 7+ messages in thread
From: Steven Rostedt @ 2005-10-20 7:00 UTC (permalink / raw)
To: Bill Davidsen; +Cc: Coywolf Qi Hunt, linux
On Wed, 19 Oct 2005, Bill Davidsen wrote:
>
> ~~~~~~~
>
> Q: Why is top-posting evil?
>
> A1: Because top-posters tend to leave the entirety of the email to which
> they are replying intact, so the email gets too long.
>
> A2: Because we prefer to use bottom-posting, and it is *extremely* hard to
> maintain a coherently flowing email conversation when some of the
> participants are bottom-posting and some are top-posting.
>
> A3: backwards read don't humans because
>
A4: top-posting is for pointy haired managers.
Sorry! ;)
-- Steve
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: lock_kernel twice possible ?
2005-10-15 7:38 ` li nux
2005-10-15 7:47 ` Coywolf Qi Hunt
@ 2005-10-15 7:58 ` Mitchell Blank Jr
1 sibling, 0 replies; 7+ messages in thread
From: Mitchell Blank Jr @ 2005-10-15 7:58 UTC (permalink / raw)
To: li nux; +Cc: Coywolf Qi Hunt, linux
li nux wrote:
> Sorry, couldn't get what you want to say.
> Can you please elaborate.
A "recursive lock" is one that can be taken multiple times by the same
owner. So:
lock_kernel();
lock_kernel();
unlock_kernel();
unlock_kernel();
is perfectly ok. The lock_kernel() code detects that the calling thread
already owns the lock and just increments current->lock_depth.
Under linux locks are non-recursive EXCEPT for lock_kernel() (aka the BLK
or "big kernel lock")
See lib/kernel_lock.c for more details.
-Mitch
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2005-10-20 7:00 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-15 7:04 lock_kernel twice possible ? li nux
2005-10-15 7:33 ` Coywolf Qi Hunt
2005-10-15 7:38 ` li nux
2005-10-15 7:47 ` Coywolf Qi Hunt
2005-10-19 21:29 ` Bill Davidsen
2005-10-20 7:00 ` Steven Rostedt
2005-10-15 7:58 ` Mitchell Blank Jr
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox