Busy polling always comes from a synchronous poll context, so for now we
can assume that it calls ->poll if present.  Move the busy polling in
sock_poll to the common block and remove it from sock_get_poll_head to
prepare for the removal of the get_poll_head method.

Signed-off-by: Christoph Hellwig <h...@lst.de>
---
 net/socket.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/socket.c b/net/socket.c
index 7cf037d21805..ca300c97b7ba 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -1135,7 +1135,6 @@ static struct wait_queue_head *sock_get_poll_head(struct 
file *file,
 
        if (!sock->ops->poll_mask)
                return NULL;
-       sock_poll_busy_loop(sock, events);
        return &sock->wq->wait;
 }
 
@@ -1161,8 +1160,9 @@ static __poll_t sock_poll(struct file *file, poll_table 
*wait)
        struct socket *sock = file->private_data;
        __poll_t events = poll_requested_events(wait), mask = 0;
 
+       sock_poll_busy_loop(sock, events);
+
        if (sock->ops->poll) {
-               sock_poll_busy_loop(sock, events);
                mask = sock->ops->poll(file, sock, wait);
        } else if (sock->ops->poll_mask) {
                sock_poll_wait(file, sock_get_poll_head(file, events), wait);
-- 
2.17.1

Reply via email to