From: Andrew Morton <akpm@linux-foundation.org>
To: Andrei Vagin <avagin@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
stable@kernel.org, Alexander Viro <viro@zeniv.linux.org.uk>
Subject: Re: [PATCH] fs: sendfile handles O_NONBLOCK of out_fd
Date: Sat, 7 May 2022 14:52:24 -0700 [thread overview]
Message-ID: <20220507145224.a9b6555969d6e66586b6514c@linux-foundation.org> (raw)
In-Reply-To: <CANaxB-wcf0Py9eCeA8YKcBSnwzW6pKAD5edCDUadebmo=JLYhA@mail.gmail.com>
On Mon, 2 May 2022 00:01:46 -0700 Andrei Vagin <avagin@gmail.com> wrote:
> Andrew, could you take a look at this patch?
>
> Here is a small reproducer for the problem:
>
> #define _GNU_SOURCE /* See feature_test_macros(7) */
> #include <fcntl.h>
> #include <stdio.h>
> #include <unistd.h>
> #include <errno.h>
> #include <sys/stat.h>
> #include <sys/types.h>
> #include <sys/sendfile.h>
>
>
> #define FILE_SIZE (1UL << 30)
> int main(int argc, char **argv) {
> int p[2], fd;
>
> if (pipe2(p, O_NONBLOCK))
> return 1;
>
> fd = open(argv[1], O_RDWR | O_TMPFILE, 0666);
> if (fd < 0)
> return 1;
> ftruncate(fd, FILE_SIZE);
>
> if (sendfile(p[1], fd, 0, FILE_SIZE) == -1) {
> fprintf(stderr, "FAIL\n");
> }
> if (sendfile(p[1], fd, 0, FILE_SIZE) != -1 || errno != EAGAIN) {
> fprintf(stderr, "FAIL\n");
> }
> return 0;
> }
>
> It worked before b964bf53e540, it is stuck after b964bf53e540, and it
> works again with this fix.
Thanks. How did b964bf53e540 cause this? do_splice_direct()
accidentally does the right thing even when SPLICE_F_NONBLOCK was not
passed?
I assume that Al will get to this. Meanwhile I can toss it
into linux-next to get some exposure and so it won't be lost.
next prev parent reply other threads:[~2022-05-07 21:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-15 0:50 Andrei Vagin
2022-05-02 7:01 ` Andrei Vagin
2022-05-07 21:52 ` Andrew Morton [this message]
2022-05-08 18:28 ` Andrei Vagin
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=20220507145224.a9b6555969d6e66586b6514c@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=avagin@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®