kernel-hacking-2024-linux-s.../fs
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
..
9p 9p: remove deprecated v9fs_fid_lookup_remove() 2007-08-23 10:13:45 -05:00
adfs
affs
afs [NET]: Make the device list and device lookups per namespace. 2007-10-10 16:49:10 -07:00
autofs
autofs4 autofs4: deadlock during create 2007-08-22 19:52:46 -07:00
befs
bfs
cifs [CIFS] Check return code on failed alloc 2007-08-18 00:15:20 +00:00
coda
configfs
cramfs
debugfs debugfs: helper for decimal challenged 2007-10-12 14:51:03 -07:00
devpts
dlm Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6 2007-10-12 15:49:37 -07:00
ecryptfs [NET]: make netlink user -> kernel interface synchronious 2007-10-10 21:15:29 -07:00
efs
exportfs
ext2
ext3 ext34: ensure do_split leaves enough free space in both blocks 2007-09-19 11:24:18 -07:00
ext4 ext34: ensure do_split leaves enough free space in both blocks 2007-09-19 11:24:18 -07:00
fat
freevxfs
fuse
gfs2 Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6 2007-10-12 15:49:37 -07:00
hfs
hfsplus
hostfs
hpfs
hppfs
hugetlbfs hugepage: fix broken check for offset alignment in hugepage mappings 2007-08-31 01:42:23 -07:00
isofs isofs: mounting to regular file may succeed 2007-07-31 15:39:41 -07:00
jbd lockdep: annotate journal_start() 2007-10-11 22:11:12 +02:00
jbd2
jffs2 Merge Linux 2.6.23 2007-10-13 14:43:54 +01:00
jfs more low-hanging fruits - kernel, fs, lib signedness 2007-10-14 12:41:52 -07:00
lockd NLM: Fix a memory leak in nlmsvc_testlock 2007-10-09 12:38:26 -07:00
minix
msdos
ncpfs NCP: delete test of long-deceased CONFIG_NCPFS_DEBUGDENTRY 2007-07-31 15:39:41 -07:00
nfs NFS: Fix an Oops in encode_lookup() 2007-09-28 15:36:42 -07:00
nfs_common
nfsd knfsd: Validate filehandle type in fsid_source 2007-09-10 18:57:47 -07:00
nls
ntfs NTFS: Fix a mount time deadlock. 2007-10-12 09:16:30 -07:00
ocfs2 Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6 2007-10-12 15:49:37 -07:00
openpromfs
partitions fs/partitions/sun.c endianness annotations 2007-10-14 12:41:51 -07:00
proc [NETNS]: Move some code into __init section when CONFIG_NET_NS=n 2007-10-10 16:54:58 -07:00
qnx4
ramfs NOMMU: Fix SYSV IPC SHM 2007-07-31 15:39:36 -07:00
reiserfs quota: fix infinite loop 2007-09-11 17:21:19 -07:00
romfs
smbfs more low-hanging fruits - kernel, fs, lib signedness 2007-10-14 12:41:52 -07:00
sysfs sysfs: add copyrights 2007-10-12 14:51:12 -07:00
sysv
udf Fix possible NULL pointer dereference in udf_table_free_blocks() 2007-08-31 01:42:22 -07:00
ufs ufs: fix sun state 2007-09-25 08:51:04 -07:00
vfat
xfs Fix up more bio fallout 2007-10-12 00:29:50 -07:00
aio.c AIO: fix cleanup in io_submit_one(...) 2007-10-08 12:58:14 -07:00
anon_inodes.c
attr.c
bad_inode.c
binfmt_aout.c
binfmt_elf.c [POWERPC] spufs: Cleanup ELF coredump extra notes logic 2007-09-19 15:12:19 +10:00
binfmt_elf_fdpic.c
binfmt_em86.c
binfmt_flat.c binfmt_flat: checkpatch fixing minimum support for the blackfin relocations 2007-10-03 23:43:57 +08:00
binfmt_misc.c
binfmt_script.c
binfmt_som.c
bio.c Drop 'size' argument from bio_endio and bi_end_io 2007-10-10 09:25:57 +02:00
block_dev.c Drop 'size' argument from bio_endio and bi_end_io 2007-10-10 09:25:57 +02:00
buffer.c Drop 'size' argument from bio_endio and bi_end_io 2007-10-10 09:25:57 +02:00
char_dev.c
compat.c
compat_ioctl.c Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 2007-10-11 19:40:14 -07:00
dcache.c
dcookies.c Remove fs.h from mm.h 2007-07-29 17:09:29 -07:00
direct-io.c Drop 'size' argument from bio_endio and bi_end_io 2007-10-10 09:25:57 +02:00
dnotify.c
dquot.c
drop_caches.c
eventfd.c
eventpoll.c
exec.c signalfd simplification 2007-09-20 13:19:59 -07:00
fcntl.c
fifo.c
file.c
file_table.c
filesystems.c
fs-writeback.c Fix warnings with !CONFIG_BLOCK 2007-10-10 09:25:57 +02:00
generic_acl.c
inode.c lockdep: annotate dir vs file i_mutex 2007-10-14 01:38:33 +02:00
inotify.c
inotify_user.c
internal.h
ioctl.c
ioprio.c
Kconfig Merge Linux 2.6.23 2007-10-13 14:43:54 +01:00
Kconfig.binfmt
libfs.c
locks.c Leases can be hidden by flocks 2007-09-11 17:21:27 -07:00
Makefile
mbcache.c
mpage.c Drop 'size' argument from bio_endio and bi_end_io 2007-10-10 09:25:57 +02:00
namei.c
namespace.c
nfsctl.c
no-block.c
open.c VFS: fix a race in lease-breaking during truncate 2007-07-31 15:39:42 -07:00
pipe.c
pnode.c
pnode.h
posix_acl.c
quota.c
quota_v1.c
quota_v2.c
read_write.c
read_write.h
readdir.c
select.c Fix select on /proc files without ->poll 2007-09-11 17:21:20 -07:00
seq_file.c [FS] seq_file: Introduce the seq_open_private() 2007-10-10 16:55:33 -07:00
signalfd.c signalfd simplification 2007-09-20 13:19:59 -07:00
splice.c Fix possible splice() mmap_sem deadlock 2007-10-01 13:17:28 -07:00
stack.c
stat.c
super.c
sync.c
timerfd.c
utimes.c
xattr.c
xattr_acl.c