* Possible deadlock in vfs layer, namei.c
@ 2006-03-02 2:46 Joshua Hudson
2006-03-02 2:54 ` Al Viro
0 siblings, 1 reply; 3+ messages in thread
From: Joshua Hudson @ 2006-03-02 2:46 UTC (permalink / raw)
To: linux-kernel
I've been hunting down various deadlocks caused by hard links to directories.
I found one that can happen *without* such things.
Consider this:
17 3 drwxr-xr-x root sys 4096 dir
18 2 drwxr-xr-x root sys 4096 dir/subdir
19 1 -rwxr-xr-x root sys 1733 dir/subdir/file
process 1 does: rename("dir/subdir/file", "dir/file")
process 2 does: rmdir("dir/subdir")
from namei.c (function: lock_rename), rename takes:
1. s_vfs_rename_sem,
2. dir/subdir: p1->d_inode->i_sem
3. dir: p2->d_inode->i_sem
rmdir takes (multiple functions):
1. dir (sys_rename)
2. dir/subdir (vfs_rename)
Suppose this happends:
[proc 1] s_vfs_rename_sem
[proc 1] dir/subdir
*task switch*
[proc 2] dir
[proc 2] dir/subdir ->deadlock
preempt_disable() won't help here. Could also be triggered on a SMP
machine w/o preempt.
Am studying situation, doesn't look promising.
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: Possible deadlock in vfs layer, namei.c
2006-03-02 2:46 Possible deadlock in vfs layer, namei.c Joshua Hudson
@ 2006-03-02 2:54 ` Al Viro
[not found] ` <bda6d13a0603011901x4b54c5a5jfed30f5fc629a3e@mail.gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Al Viro @ 2006-03-02 2:54 UTC (permalink / raw)
To: Joshua Hudson; +Cc: linux-kernel
On Wed, Mar 01, 2006 at 06:46:42PM -0800, Joshua Hudson wrote:
> I've been hunting down various deadlocks caused by hard links to directories.
> I found one that can happen *without* such things.
> process 1 does: rename("dir/subdir/file", "dir/file")
> process 2 does: rmdir("dir/subdir")
>
> from namei.c (function: lock_rename), rename takes:
> 1. s_vfs_rename_sem,
> 2. dir/subdir: p1->d_inode->i_sem
> 3. dir: p2->d_inode->i_sem
No, it doesn't. Wrong order - it will take dir before dir/subdir.
RTFM - Documentation/filesystems/directory-locking is there for
purpose.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-03-02 3:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-02 2:46 Possible deadlock in vfs layer, namei.c Joshua Hudson
2006-03-02 2:54 ` Al Viro
[not found] ` <bda6d13a0603011901x4b54c5a5jfed30f5fc629a3e@mail.gmail.com>
2006-03-02 3:22 ` Fwd: " Joshua Hudson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.