[PATCH] Fix deadlock on regular nonseekable files
From: Vitaly Chernooky
Date: Fri Mar 20 2015 - 06:26:37 EST
'Commit 9c225f2655e36a470c4f58dbbc99244c5fc7f2d4 ("vfs: atomic f_pos
accesses as per POSIX")' introduce following regression. If some program
does multithreaded IO on file in pseudo-filesystem, like procfs, with
nonseekable files marked as regular, we get deadlock on f_pos_lock
mutex, if there are simultaneous reading and writing by different
threads.
Signed-off-by: Vitaly Chernooky <vitaly.chernooky@xxxxxxxxxxxxxxx>
---
fs/open.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/open.c b/fs/open.c
index 33f9cbf..1a4f84b 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -1135,7 +1135,7 @@ EXPORT_SYMBOL(generic_file_open);
*/
int nonseekable_open(struct inode *inode, struct file *filp)
{
- filp->f_mode &= ~(FMODE_LSEEK | FMODE_PREAD | FMODE_PWRITE);
+ filp->f_mode &= ~(FMODE_LSEEK | FMODE_PREAD | FMODE_PWRITE |
FMODE_ATOMIC_POS);
return 0;
}
--
1.7.9.5
With best regards,
--
Vitaly Chernooky | Senior Developer - Product Engineering and Development
GlobalLogic
P +380.44.4929695 ext.1136 M +380.63.6011802 S cvv_2k
www.globallogic.com
http://www.globallogic.com/email_disclaimer.txt
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/