udf deadlock (was Re: hugetlbfs lockdep spew revisited.)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 17, 2012 at 12:49:22AM +0000, Al Viro wrote:
> Folks, this is not a false positive and it has nothing to do with misannotation
> for directories.  Deadlock is real; I have no idea WTF do we what ->i_mutex
> held over that area in hugetlbfs ->mmap(), but doing that is really, really
> wrong, whatever the reason.

Arrrrgh...  Some grepping around has uncovered another deadlock on
i_mutex/mmap_sem and this one is not hard to hit at all.

Thread A:
	opens file on UDF (O_RDWR open)
	does big, fat write() to it
Thread B:
	opens the same file (also O_RDWR)
	mmaps it
	closes
	does munmap()

and there we are - munmap() will end up closing the second struct file,
call udf_release_file() and we are hitting ->i_mutex while under
->mmap_sem.  Blocking on it, actually, since generic_file_aio_write()
in the first thread is holding ->i_mutex.  And as soon as thread A gets
around to faulting the next piece of data in, well...  To widen the
window a lot, mmap something large sitting on NFS and do write() from
that mmapped area.  Race window as wide as one could ask for...

What happens there is prealloc discard on close; do we even want ->i_mutex
there these days?  Note that there's also
	down_write(&UDF_I(inode)->i_data_sem);
in udf_release_file()...
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux