linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: 运辉崔 <cuiyunhui@bytedance.com>
Cc: mhiramat@kernel.org, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, duanxiongchun@bytedance.com,
	kuniyu@amazon.com, linux-kernel@vger.kernel.org,
	linux-trace-kernel@vger.kernel.org
Subject: Re: [External] Re: [PATCH v2] sock: add tracepoint for send recv length
Date: Thu, 5 Jan 2023 23:07:37 -0500	[thread overview]
Message-ID: <20230105230737.426abfdd@gandalf.local.home> (raw)
In-Reply-To: <CAEEQ3wmnUpuZxLbrMwPCk+pnbC27fo4bi-nN-848o6QGO6Xt+Q@mail.gmail.com>

On Fri, 6 Jan 2023 11:24:18 +0800
运辉崔 <cuiyunhui@bytedance.com> wrote:

> Regardless of whether the MSG_PEEK flag is set or not, it is possible
> to return -errno,
> but based on your suggestion, I plan to modify it like this:
> 
> trace_sock_recvmsg_length(sock->sk, sock->sk->sk_family,
>                           sock->sk->sk_protocol,
>                           !(flags & MSG_PEEK) ? ret : (ret < 0 ? ret : 0),
> 
> what do you think?

Sure.

But note, from your original patch:

> +	trace_sock_recvmsg_length(sock->sk, sock->sk->sk_family,
> +				  sock->sk->sk_protocol,
> +				  (ret > 0 && !(flags & MSG_PEEK)) ?
> +				  ret : 0,
> +				  (ret > 0 && !(flags & MSG_PEEK)) ? 0 : ret,
> +				  flags);

If flags MSG_PEEK is set, you return ret in error regardless, so error
would be ret even if it was positive.

So I'm guessing that this change actually fixed a bug. ;-)

-- Steve

  reply	other threads:[~2023-01-06  4:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-05 10:00 [PATCH v2] sock: add tracepoint for send recv length Yunhui Cui
2023-01-05 12:02 ` Paolo Abeni
2023-01-06  2:57   ` [External] " 运辉崔
2023-01-05 14:08 ` Steven Rostedt
2023-01-06  3:24   ` [External] " 运辉崔
2023-01-06  4:07     ` Steven Rostedt [this message]
2023-01-06  4:23       ` 运辉崔

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=20230105230737.426abfdd@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=cuiyunhui@bytedance.com \
    --cc=davem@davemloft.net \
    --cc=duanxiongchun@bytedance.com \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=kuniyu@amazon.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=pabeni@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).