All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vitaly Chernooky <vitalii.chernookyi@globallogic.com>
To: Alexander Viro <viro@zeniv.linux.org.uk>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	Linus Torvalds <torvalds@linux-foundation.org>
Cc: "David Vrabel" <david.vrabel@citrix.com>,
	"Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>,
	"Iurii Konovalenko" <iurii.konovalenko@globallogic.com>,
	"Ian Campbell" <ian.campbell@citrix.com>,
	"Boris Ostrovsky" <boris.ostrovsky@oracle.com>,
	"Andrii Anisov" <andrii.anisov@globallogic.com>,
	"Artem Mygaiev" <artem.mygaiev@globallogic.com>
Subject: [PATCH] [RFC] Fix deadlock on regular nonseekable files
Date: Fri, 20 Mar 2015 15:17:54 +0200	[thread overview]
Message-ID: <CANZZXhCCUh12_1gt0ppc4cMMR-BUsq4rySqNihsEJziOGYbh3A@mail.gmail.com> (raw)

>From 8ef72cde695d1b1a3e9f6165477c9e7415fca2b1 Mon Sep 17 00:00:00 2001
From: Vitaly Chernooky <vitaly.chernooky@globallogic.com>
Date: Fri, 20 Mar 2015 12:26:37 +0200
Subject: [PATCH] Fix deadlock on regular nonseekable files

'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@globallogic.com>
---
 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

             reply	other threads:[~2015-03-20 13:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-20 13:17 Vitaly Chernooky [this message]
2015-03-20 13:42 ` [PATCH] [RFC] Fix deadlock on regular nonseekable files Al Viro
2015-03-20 14:22   ` Vitaly Chernooky
2015-03-20 14:22     ` Vitaly Chernooky
2015-03-20 14:46     ` Al Viro
2015-03-20 17:37       ` Vitaly Chernooky
2015-03-20 17:55         ` Al Viro
2015-03-20 19:00           ` Marek Marczykowski-Górecki
2015-03-20 19:35             ` Al Viro
2015-03-20 19:35               ` Al Viro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CANZZXhCCUh12_1gt0ppc4cMMR-BUsq4rySqNihsEJziOGYbh3A@mail.gmail.com \
    --to=vitalii.chernookyi@globallogic.com \
    --cc=andrii.anisov@globallogic.com \
    --cc=artem.mygaiev@globallogic.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=david.vrabel@citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=iurii.konovalenko@globallogic.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marmarek@invisiblethingslab.com \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.