linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Vitaly Chernooky <vitalii.chernookyi@globallogic.com>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	Linus Torvalds <torvalds@linux-foundation.org>,
	David Vrabel <david.vrabel@citrix.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: Re: [PATCH] [RFC] Fix deadlock on regular nonseekable files
Date: Fri, 20 Mar 2015 20:00:52 +0100	[thread overview]
Message-ID: <20150320190052.GF2321@mail-itl> (raw)
In-Reply-To: <20150320175516.GC29656@ZenIV.linux.org.uk>

[-- Attachment #1: Type: text/plain, Size: 2610 bytes --]

On Fri, Mar 20, 2015 at 05:55:17PM +0000, Al Viro wrote:
> On Fri, Mar 20, 2015 at 07:37:58PM +0200, Vitaly Chernooky wrote:
> > > What does it have to do with filesystem type involved?
> > 
> > Discussed trouble directly depends on is it used nonseekable_open() in
> > fs driver or not. Regular fss like ext4 does not use
> > nonseekable_open() so there is no troubles. But others like ubifs,
> > debugfs, fuse and xenfs use it and are affected by discussed
> > regression.
> 
> What does nonseekable_open() have to do with that, other than as
> a heuristics for "we want to break 2.9.7"?
> 
> > I do not know who, when and why has introduced this
> > mess. It is pre-git historical code. And now by introducing
> > FMODE_ATOMIC_POS we change behavior of this mature practice and affect
> > at least few filesystems. Yes, following standards is good, but I do
> > not accept than breaking mature code is good idea. So I have chosen to
> > clear FMODE_ATOMIC_POS in nonseekable_open() simultaneously with
> > FMODE_LSEEK because it returns that nonseekable semi-standard files
> > back to life. I guess, it is the best solution for now. And, also, XEN
> > guys are happy with this solution.
> > 
> > So what do you think about all this mess and may be it is possible to
> > have got better solution?
> 
> 	What the devil does that have to do with seeks, anyway?  Exact
> same problem will happen for blocking read() vs. another read() attempts
> on the same descriptor.  With perfectly accepted lseek() (which will also
> have to block, as per 2.9.7).

Yes, the problem here is because this particular file (/proc/xen/xenbus)
blocks the read() operation waiting for new events. Because of said
commit, now it also blocks write() operation used to send some request
(which would result in some response, so unblocking read() call). It
shouldn't be a normal file in the first place...

> 	Which file is that?  And what behaviour did you get on old kernels
> with it?  All reads block inside ->read() rather than sys_read()?

This is /proc/xen/xenbus. 

> 	Details, please.  Your strace doesn't show the relevant open(),
> so it's hard to tell what's really going on there in that regression.
> I agree that user-visible behaviour changes need to be dealt with; it's
> the nature of your fix I've a problem with.

Maybe its better to change the file type? Character device? Pipe?

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]

  reply	other threads:[~2015-03-20 19:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-20 13:17 [PATCH] [RFC] Fix deadlock on regular nonseekable files Vitaly Chernooky
2015-03-20 13:42 ` Al Viro
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 [this message]
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=20150320190052.GF2321@mail-itl \
    --to=marmarek@invisiblethingslab.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=torvalds@linux-foundation.org \
    --cc=viro@ZenIV.linux.org.uk \
    --cc=vitalii.chernookyi@globallogic.com \
    /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 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).