linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Brauner <brauner@kernel.org>
To: Mikulas Patocka <mpatocka@redhat.com>
Cc: Hugh Dickins <hughd@google.com>,
	 Alexander Viro <viro@zeniv.linux.org.uk>,
	Jan Kara <jack@suse.cz>,
	linux-fsdevel@vger.kernel.org,  linux-mm@kvack.org
Subject: Re: [PATCH] tmpfs: don't interrupt fallocate with EINTR
Date: Tue, 5 Mar 2024 11:10:47 +0100	[thread overview]
Message-ID: <20240305-zugunsten-busbahnhof-6dc705d80152@brauner> (raw)
In-Reply-To: <84acfa88-816f-50d7-50a2-92ea7a7db42@redhat.com>

On Tue, Mar 05, 2024 at 10:34:26AM +0100, Mikulas Patocka wrote:
> 
> 
> On Tue, 5 Mar 2024, Christian Brauner wrote:
> 
> > On Mon, Mar 04, 2024 at 07:43:39PM +0100, Mikulas Patocka wrote:
> > > 
> > > Index: linux-2.6/mm/shmem.c
> > > ===================================================================
> > > --- linux-2.6.orig/mm/shmem.c	2024-01-18 19:18:31.000000000 +0100
> > > +++ linux-2.6/mm/shmem.c	2024-03-04 19:05:25.000000000 +0100
> > > @@ -3143,7 +3143,7 @@ static long shmem_fallocate(struct file
> > >  		 * Good, the fallocate(2) manpage permits EINTR: we may have
> > >  		 * been interrupted because we are using up too much memory.
> > >  		 */
> > > -		if (signal_pending(current))
> > > +		if (fatal_signal_pending(current))
> > 
> > I think that's likely wrong and probably would cause regressions as
> > there may be users relying on this?
> 
> ext4 fallocate doesn't return -EINTR. So, userspace code can't rely on it.

I'm confused what does this have to do with ext4 since this is about
tmpfs. Also note, that fallocate(2) documents EINTR as a valid return
value. And fwiw, the manpage also states that "EINTR  A signal was
caught during execution; see signal(7)." not a "fatal signal".

Aside from that. If a user sends SIGUSR1 then with the code as it is now
that fallocate call will be interrupted. With your change that SIGUSR1
won't do anything anymore. Instead userspace would need to send SIGKILL.
So userspace that uses SIGUSR1 will suddenly hang.

  reply	other threads:[~2024-03-05 10:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-04 18:43 [PATCH] tmpfs: don't interrupt fallocate with EINTR Mikulas Patocka
2024-03-05  8:42 ` Christian Brauner
2024-03-05  9:34   ` Mikulas Patocka
2024-03-05 10:10     ` Christian Brauner [this message]
2024-03-05 14:03       ` Mikulas Patocka
2024-03-07 10:47         ` Christian Brauner
2024-03-06 17:49   ` Jan Kara
2024-03-07 10:45     ` Christian Brauner
2024-03-07 14:59       ` Matthew Wilcox
2024-05-15 22:10 Jan Kara
2024-05-15 23:09 ` Matthew Wilcox

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=20240305-zugunsten-busbahnhof-6dc705d80152@brauner \
    --to=brauner@kernel.org \
    --cc=hughd@google.com \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mpatocka@redhat.com \
    --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 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).