diff options
author | Jan Kara <jack@suse.cz> | 2012-02-20 17:54:00 +0100 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-03-10 16:05:38 -0500 |
commit | f6940fe9092e796119af691c7f722c252f4fc524 (patch) | |
tree | 648da154cc48352b12982b4407e72121ceac9ecb /fs/udf/file.c | |
parent | 978d6d8c4574098050b22281b9ed06818c0b23ca (diff) | |
download | linux-f6940fe9092e796119af691c7f722c252f4fc524.tar.gz linux-f6940fe9092e796119af691c7f722c252f4fc524.tar.bz2 linux-f6940fe9092e796119af691c7f722c252f4fc524.zip |
udf: Fix deadlock in udf_release_file()
udf_release_file() can be called from munmap() path with mmap_sem held. Thus
we cannot take i_mutex there because that ranks above mmap_sem. Luckily,
i_mutex is not needed in udf_release_file() anymore since protection by
i_data_sem is enough to protect from races with write and truncate.
Reported-by: Al Viro <viro@ZenIV.linux.org.uk>
Reviewed-by: Namjae Jeon <linkinjeon@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/udf/file.c')
-rw-r--r-- | fs/udf/file.c | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/fs/udf/file.c b/fs/udf/file.c index dca0c3881e82..d567b8448dfc 100644 --- a/fs/udf/file.c +++ b/fs/udf/file.c @@ -201,12 +201,10 @@ out: static int udf_release_file(struct inode *inode, struct file *filp) { if (filp->f_mode & FMODE_WRITE) { - mutex_lock(&inode->i_mutex); down_write(&UDF_I(inode)->i_data_sem); udf_discard_prealloc(inode); udf_truncate_tail_extent(inode); up_write(&UDF_I(inode)->i_data_sem); - mutex_unlock(&inode->i_mutex); } return 0; } |