Netdev List
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: cugyly@163.com
Cc: netdev@vger.kernel.org, Linyu.Yuan@alcatel-sbell.com.cn
Subject: Re: [PATCH net-next] net: tap: fix POLLOUT condition in tap_poll()
Date: Sat, 16 Dec 2017 23:03:21 -0500 (EST)	[thread overview]
Message-ID: <20171216.230321.468890097045981694.davem@davemloft.net> (raw)
In-Reply-To: <1513261336-5209-1-git-send-email-cugyly@163.com>

From: yuan linyu <cugyly@163.com>
Date: Thu, 14 Dec 2017 22:22:16 +0800

> From: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
> 
> from logical view, if sock_writeable(&q->sk) return false,
> original second condition will return false too,
> change it and make second condition can return true.
> 
> Signed-off-by: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
 ...
> @@ -587,8 +587,7 @@ static unsigned int tap_poll(struct file *file, poll_table *wait)
>  		mask |= POLLIN | POLLRDNORM;
>  
>  	if (sock_writeable(&q->sk) ||
> -	    (!test_and_set_bit(SOCKWQ_ASYNC_NOSPACE, &q->sock.flags) &&
> -	     sock_writeable(&q->sk)))
> +	    !test_and_set_bit(SOCKWQ_ASYNC_NOSPACE, &q->sock.flags))
>  		mask |= POLLOUT | POLLWRNORM;
>  
>  out:
> -- 
> 2.7.4

Hmmm, this same exact test also exists in tun_chr_poll().

The second condition probably never trigger, because of the reasons
you have listed.  The only side effect is that it will set the
ASYNC_NOSPACE bit in the socket flags.

Logically, it seems we can remove the second condition altogether.

But I wonder what might break if we stop trying to set that socket
flags bit in this situation.

Overall, I'm not sure this change is safe at all.

      reply	other threads:[~2017-12-17  4:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-14 14:22 [PATCH net-next] net: tap: fix POLLOUT condition in tap_poll() yuan linyu
2017-12-17  4:03 ` David Miller [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=20171216.230321.468890097045981694.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=Linyu.Yuan@alcatel-sbell.com.cn \
    --cc=cugyly@163.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