diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-04 16:57:43 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-04 16:57:43 -0400 |
commit | 408afb8d7847faea115508ba154346e33edfc7d5 (patch) | |
tree | 9b558f8477d7400ad5e8849c2624471915654ade /net/ipv4/tcp.c | |
parent | b058efc1acfd99027b4c70458e72c3d20a1a5bbc (diff) | |
parent | 1da92779e2e8f309d5aecbbed346e7f812b174e8 (diff) |
Merge branch 'work.aio-1' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull aio updates from Al Viro:
"Majority of AIO stuff this cycle. aio-fsync and aio-poll, mostly.
The only thing I'm holding back for a day or so is Adam's aio ioprio -
his last-minute fixup is trivial (missing stub in !CONFIG_BLOCK case),
but let it sit in -next for decency sake..."
* 'work.aio-1' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (46 commits)
aio: sanitize the limit checking in io_submit(2)
aio: fold do_io_submit() into callers
aio: shift copyin of iocb into io_submit_one()
aio_read_events_ring(): make a bit more readable
aio: all callers of aio_{read,write,fsync,poll} treat 0 and -EIOCBQUEUED the same way
aio: take list removal to (some) callers of aio_complete()
aio: add missing break for the IOCB_CMD_FDSYNC case
random: convert to ->poll_mask
timerfd: convert to ->poll_mask
eventfd: switch to ->poll_mask
pipe: convert to ->poll_mask
crypto: af_alg: convert to ->poll_mask
net/rxrpc: convert to ->poll_mask
net/iucv: convert to ->poll_mask
net/phonet: convert to ->poll_mask
net/nfc: convert to ->poll_mask
net/caif: convert to ->poll_mask
net/bluetooth: convert to ->poll_mask
net/sctp: convert to ->poll_mask
net/tipc: convert to ->poll_mask
...
Diffstat (limited to 'net/ipv4/tcp.c')
-rw-r--r-- | net/ipv4/tcp.c | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index c9d00ef54dec..dec47e6789e7 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -494,32 +494,21 @@ static inline bool tcp_stream_is_readable(const struct tcp_sock *tp, | |||
494 | } | 494 | } |
495 | 495 | ||
496 | /* | 496 | /* |
497 | * Wait for a TCP event. | 497 | * Socket is not locked. We are protected from async events by poll logic and |
498 | * | 498 | * correct handling of state changes made by other threads is impossible in |
499 | * Note that we don't need to lock the socket, as the upper poll layers | 499 | * any case. |
500 | * take care of normal races (between the test and the event) and we don't | ||
501 | * go look at any of the socket buffers directly. | ||
502 | */ | 500 | */ |
503 | __poll_t tcp_poll(struct file *file, struct socket *sock, poll_table *wait) | 501 | __poll_t tcp_poll_mask(struct socket *sock, __poll_t events) |
504 | { | 502 | { |
505 | __poll_t mask; | ||
506 | struct sock *sk = sock->sk; | 503 | struct sock *sk = sock->sk; |
507 | const struct tcp_sock *tp = tcp_sk(sk); | 504 | const struct tcp_sock *tp = tcp_sk(sk); |
505 | __poll_t mask = 0; | ||
508 | int state; | 506 | int state; |
509 | 507 | ||
510 | sock_poll_wait(file, sk_sleep(sk), wait); | ||
511 | |||
512 | state = inet_sk_state_load(sk); | 508 | state = inet_sk_state_load(sk); |
513 | if (state == TCP_LISTEN) | 509 | if (state == TCP_LISTEN) |
514 | return inet_csk_listen_poll(sk); | 510 | return inet_csk_listen_poll(sk); |
515 | 511 | ||
516 | /* Socket is not locked. We are protected from async events | ||
517 | * by poll logic and correct handling of state changes | ||
518 | * made by other threads is impossible in any case. | ||
519 | */ | ||
520 | |||
521 | mask = 0; | ||
522 | |||
523 | /* | 512 | /* |
524 | * EPOLLHUP is certainly not done right. But poll() doesn't | 513 | * EPOLLHUP is certainly not done right. But poll() doesn't |
525 | * have a notion of HUP in just one direction, and for a | 514 | * have a notion of HUP in just one direction, and for a |
@@ -600,7 +589,7 @@ __poll_t tcp_poll(struct file *file, struct socket *sock, poll_table *wait) | |||
600 | 589 | ||
601 | return mask; | 590 | return mask; |
602 | } | 591 | } |
603 | EXPORT_SYMBOL(tcp_poll); | 592 | EXPORT_SYMBOL(tcp_poll_mask); |
604 | 593 | ||
605 | int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg) | 594 | int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg) |
606 | { | 595 | { |