linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vfs: avoid atomic f_pos accesses for non-seekable files
@ 2016-04-05 14:08 Jan Beulich
  2016-04-05 14:19 ` Linus Torvalds
  0 siblings, 1 reply; 7+ messages in thread
From: Jan Beulich @ 2016-04-05 14:08 UTC (permalink / raw)
  To: viro; +Cc: Linus Torvalds, linux-fsdevel

Commit 9c225f2655 ("vfs: atomic f_pos accesses as per POSIX") may have
gone a little too far: We've had a report of a deadlock of an
application accessing a /proc file through the same file descriptor
from multiple threads. While /proc files are regular ones, them (and
similarly others which are) often not being seekable really already
makes them deviate from how regular files would behave.

Since for non-seekable files the file position is kind of a strange
thing anyway, also don't enforce atomic position updates for them.

(I do recognize that the application isn't really standard conforming,
as it should use multiple file descriptors from all I understand. But
it worked fine before that change, and so they claim the kernel to be
at fault.)

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
---
 fs/open.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- 4.6-rc2/fs/open.c
+++ 4.6-rc2-nonseekable-no-atomic-pos/fs/open.c
@@ -1142,7 +1142,8 @@ 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;
 }
 




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-04-05 18:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-05 14:08 [PATCH] vfs: avoid atomic f_pos accesses for non-seekable files Jan Beulich
2016-04-05 14:19 ` Linus Torvalds
2016-04-05 14:28   ` Jan Beulich
2016-04-05 14:44     ` Linus Torvalds
2016-04-05 15:17       ` [PATCH v2] " Jan Beulich
2016-04-05 16:51         ` Al Viro
2016-04-05 18:02           ` Linus Torvalds

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).