bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Sitnicki <jakub@cloudflare.com>
To: Martin Lau <kafai@fb.com>
Cc: "bpf\@vger.kernel.org" <bpf@vger.kernel.org>,
	"netdev\@vger.kernel.org" <netdev@vger.kernel.org>,
	"kernel-team\@cloudflare.com" <kernel-team@cloudflare.com>,
	Alexei Starovoitov <ast@kernel.org>,
	"Andrii Nakryiko" <andriin@fb.com>
Subject: Re: [PATCH bpf-next] selftests/bpf: Restore the netns after flow dissector reattach test
Date: Fri, 18 Oct 2019 11:07:11 +0200	[thread overview]
Message-ID: <87pniucthc.fsf@cloudflare.com> (raw)
In-Reply-To: <20191017181812.eb23epbwnp3fo5sg@kafai-mbp.dhcp.thefacebook.com>

On Thu, Oct 17, 2019 at 08:18 PM CEST, Martin Lau wrote:
> On Thu, Oct 17, 2019 at 10:37:52AM +0200, Jakub Sitnicki wrote:

[...]

>> ---
>>  .../bpf/prog_tests/flow_dissector_reattach.c  | 21 +++++++++++++++----
>>  1 file changed, 17 insertions(+), 4 deletions(-)
>>
>> diff --git a/tools/testing/selftests/bpf/prog_tests/flow_dissector_reattach.c b/tools/testing/selftests/bpf/prog_tests/flow_dissector_reattach.c
>> index 777faffc4639..1f51ba66b98b 100644
>> --- a/tools/testing/selftests/bpf/prog_tests/flow_dissector_reattach.c
>> +++ b/tools/testing/selftests/bpf/prog_tests/flow_dissector_reattach.c
>> @@ -91,12 +91,18 @@ static void do_flow_dissector_reattach(void)
>>
>>  void test_flow_dissector_reattach(void)
>>  {
>> -	int init_net, err;
>> +	int init_net, self_net, err;
>> +
>> +	self_net = open("/proc/self/ns/net", O_RDONLY);
>> +	if (CHECK_FAIL(self_net < 0)) {
>> +		perror("open(/proc/self/ns/net");
>> +		return;
>> +	}
>>
>>  	init_net = open("/proc/1/ns/net", O_RDONLY);
>>  	if (CHECK_FAIL(init_net < 0)) {
>>  		perror("open(/proc/1/ns/net)");
>> -		return;
>> +		goto out_close;
> Mostly nit.  close(-1) is ok-ish...  The same goes for the "out_close" in
> do_flow_dissector_reattach().

Happy to fix it up. Is your concern that calls to close invalid FDs
clutter strace output or something else?

>
> Acked-by: Martin KaFai Lau <kafai@fb.com>

Thanks for the review.

-Jakub

      parent reply	other threads:[~2019-10-18  9:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-17  8:37 [PATCH bpf-next] selftests/bpf: Restore the netns after flow dissector reattach test Jakub Sitnicki
2019-10-17 18:18 ` Martin Lau
2019-10-17 19:13   ` Alexei Starovoitov
2019-10-18  9:07   ` Jakub Sitnicki [this message]

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=87pniucthc.fsf@cloudflare.com \
    --to=jakub@cloudflare.com \
    --cc=andriin@fb.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=kafai@fb.com \
    --cc=kernel-team@cloudflare.com \
    --cc=netdev@vger.kernel.org \
    /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).