kernel-hacking-2024-linux-s.../include
Peter Zijlstra 14358e6dda lockdep: annotate dir vs file i_mutex
On Mon, 2007-09-24 at 22:13 -0400, Steven Rostedt wrote:
> The circular lock seems to be this:
> 
> #1:
> 
>   sys_mmap2:              down_write(&mm->mmap_sem);
>   nfs_revalidate_mapping: mutex_lock(&inode->i_mutex);
> 
> 
> #0:
> 
>   vfs_readdir:     mutex_lock(&inode->i_mutex);
>    - during the readdir (filldir64), we take a user fault (missing page?)
>     and call do_page_fault -
>   do_page_fault:   down_read(&mm->mmap_sem);
> 
> 
> So it does indeed look like a circular locking. Now the question is, "is
> this a bug?".  Looking like the inode of #1 must be a file or something
> else that you can mmap and the inode of #0 seems it must be a directory.
> I would say "no".
> 
> Now if you can readdir on a file or mmap a directory, then this could be
> an issue.
> 
> Otherwise, I'd love to see someone teach lockdep about this issue! ;-)

Make a distinction between file and dir usage of i_mutex.
The inode should be complete and unused at unlock_new_inode(), re-init
i_mutex depending on its type.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
2007-10-14 01:38:33 +02:00
..
acpi
asm-alpha
asm-arm endianness annotations in arm io.h 2007-10-14 12:41:52 -07:00
asm-avr32
asm-blackfin Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 2007-10-13 14:58:23 +01:00
asm-cris
asm-frv frv: missing casts in cmpxchg() 2007-10-14 12:41:51 -07:00
asm-generic fix sparc32 breakage (result of vmlinux.lds.S bug) 2007-10-13 09:58:59 -07:00
asm-h8300
asm-ia64
asm-m32r
asm-m68k m68k: Export cachectl.h 2007-10-13 09:41:03 -07:00
asm-m68knommu
asm-mips [MIPS] CFE: Add missing parenthesis. 2007-10-13 00:53:00 +01:00
asm-parisc
asm-powerpc endian-clean in_le64/out_le64 2007-10-14 12:41:51 -07:00
asm-ppc
asm-s390
asm-sh Merge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6 2007-10-13 09:49:04 -07:00
asm-sh64 Merge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh64-2.6 2007-10-13 09:50:26 -07:00
asm-sparc [SPARC32]: Add irqflags.h to sparc32 and use it from generic code. 2007-10-13 21:53:11 -07:00
asm-sparc64 [SPARC64]: virt_irq --> bucket mapping no longer necessary 2007-10-13 23:50:38 -07:00
asm-um
asm-v850
asm-x86 lockdep: x86_64: connect the sysexit hook 2007-10-11 22:11:12 +02:00
asm-xtensa
crypto
keys
linux lockdep: annotate dir vs file i_mutex 2007-10-14 01:38:33 +02:00
math-emu
media v4l: copy_to_user() is not a good method name 2007-10-13 09:58:59 -07:00
mtd
net
pcmcia
rdma
rxrpc
scsi
sound
video
xen
Kbuild