mptcp.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Mat Martineau <mathew.j.martineau@linux.intel.com>
To: Florian Westphal <fw@strlen.de>
Cc: mptcp@lists.linux.dev, matthieu.baerts@tessares.net,
	 Paolo Abeni <pabeni@redhat.com>, Xiumei Mu <xmu@redhat.com>
Subject: Re: [PATCH v2 mptcp] selftests: mptcp: make sendfile selftest work
Date: Fri, 29 Jul 2022 11:07:44 -0700 (PDT)	[thread overview]
Message-ID: <7ff00ad-80b5-8ab-6544-fdfaefd43f0@linux.intel.com> (raw)
In-Reply-To: <20220729095550.3040-1-fw@strlen.de>

On Fri, 29 Jul 2022, Florian Westphal wrote:

> When the selftest got added, sendfile() on mptcp sockets returned
> -EOPNOTSUPP, so running 'mptcp_connect.sh -m sendfile' failed
> immediately.
>
> This is no longer the case, but the script fails anyway due to timeout.
> Let the receiver know once the sender has sent all data, just like
> with '-m mmap' mode.
>
> v2: need to respect cfg_wait too, as pm_userspace.sh relied
> on -m sendfile to keep the connection open (Mat Martineau)
>
> Fixes: 048d19d444be ("mptcp: add basic kselftest for mptcp")
> Reported-by: Xiumei Mu <xmu@redhat.com>
> Signed-off-by: Florian Westphal <fw@strlen.de>

Looks good to me, tests run fine on my system. I tried to reproduce the 
failures that CI reported on the non-debug build but so far it doesn't 
look like this change caused those failures.

With the Fixes: tag I assume this is intended for -net?

Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>


> ---
> .../selftests/net/mptcp/mptcp_connect.c       | 26 ++++++++++++-------
> 1 file changed, 17 insertions(+), 9 deletions(-)
>
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.c b/tools/testing/selftests/net/mptcp/mptcp_connect.c
> index e2ea6c126c99..24d4e9cb617e 100644
> --- a/tools/testing/selftests/net/mptcp/mptcp_connect.c
> +++ b/tools/testing/selftests/net/mptcp/mptcp_connect.c
> @@ -553,6 +553,18 @@ static void set_nonblock(int fd, bool nonblock)
> 		fcntl(fd, F_SETFL, flags & ~O_NONBLOCK);
> }
>
> +static void shut_wr(int fd)
> +{
> +	/* Close our write side, ev. give some time
> +	 * for address notification and/or checking
> +	 * the current status
> +	 */
> +	if (cfg_wait)
> +		usleep(cfg_wait);
> +
> +	shutdown(fd, SHUT_WR);
> +}
> +
> static int copyfd_io_poll(int infd, int peerfd, int outfd, bool *in_closed_after_out)
> {
> 	struct pollfd fds = {
> @@ -630,14 +642,7 @@ static int copyfd_io_poll(int infd, int peerfd, int outfd, bool *in_closed_after
> 					/* ... and peer also closed already */
> 					break;
>
> -				/* ... but we still receive.
> -				 * Close our write side, ev. give some time
> -				 * for address notification and/or checking
> -				 * the current status
> -				 */
> -				if (cfg_wait)
> -					usleep(cfg_wait);
> -				shutdown(peerfd, SHUT_WR);
> +				shut_wr(peerfd);
> 			} else {
> 				if (errno == EINTR)
> 					continue;
> @@ -767,7 +772,7 @@ static int copyfd_io_mmap(int infd, int peerfd, int outfd,
> 		if (err)
> 			return err;
>
> -		shutdown(peerfd, SHUT_WR);
> +		shut_wr(peerfd);
>
> 		err = do_recvfile(peerfd, outfd);
> 		*in_closed_after_out = true;
> @@ -791,6 +796,9 @@ static int copyfd_io_sendfile(int infd, int peerfd, int outfd,
> 		err = do_sendfile(infd, peerfd, size);
> 		if (err)
> 			return err;
> +
> +		shut_wr(peerfd);
> +
> 		err = do_recvfile(peerfd, outfd);
> 		*in_closed_after_out = true;
> 	}
> -- 
> 2.35.1
>
>

--
Mat Martineau
Intel

  parent reply	other threads:[~2022-07-29 18:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-29  9:55 [PATCH v2 mptcp] selftests: mptcp: make sendfile selftest work Florian Westphal
2022-07-29 11:20 ` selftests: mptcp: make sendfile selftest work: Tests Results MPTCP CI
2022-07-29 18:07 ` Mat Martineau [this message]
2022-07-29 21:20   ` [PATCH v2 mptcp] selftests: mptcp: make sendfile selftest work Florian Westphal
2022-08-03 16:34 ` Matthieu Baerts

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=7ff00ad-80b5-8ab-6544-fdfaefd43f0@linux.intel.com \
    --to=mathew.j.martineau@linux.intel.com \
    --cc=fw@strlen.de \
    --cc=matthieu.baerts@tessares.net \
    --cc=mptcp@lists.linux.dev \
    --cc=pabeni@redhat.com \
    --cc=xmu@redhat.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).