Fixes for the AIO poll revert

5 messages, 2 authors, 2018-06-29 · open the first message on its own page

Fixes for the AIO poll revert

From: Christoph Hellwig <hch@lst.de>
Date: 2018-06-29 13:37:23

Two fixup for incorrectly reverted bits.

[PATCH 1/2] net: handle NULL ->poll gracefully

From: Christoph Hellwig <hch@lst.de>
Date: 2018-06-29 13:37:36

The big aio poll revert broke various network protocols that don't
implement ->poll as a patch in the aio poll serie removed sock_no_poll
and made the common code handle this case.

Fixes: a11e1d43 ("Revert changes to convert to ->poll_mask() and aio IOCB_CMD_POLL")
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 net/socket.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/net/socket.c b/net/socket.c
index a564c6ed19d5..85633622c94d 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -1133,6 +1133,8 @@ static __poll_t sock_poll(struct file *file, poll_table *wait)
 	__poll_t events = poll_requested_events(wait);
 
 	sock_poll_busy_loop(sock, events);
+	if (!sock->ops->poll)
+		return 0;
 	return sock->ops->poll(file, sock, wait) | sock_poll_busy_flag(sock);
 }
 
-- 
2.18.0

Re: [PATCH 1/2] net: handle NULL ->poll gracefully

From: Linus Torvalds <torvalds@linux-foundation.org>
Date: 2018-06-29 13:46:57

On Fri, Jun 29, 2018 at 6:37 AM Christoph Hellwig [off-list ref] wrote:
The big aio poll revert broke various network protocols that don't
implement ->poll as a patch in the aio poll serie removed sock_no_poll
and made the common code handle this case.
Hmm. I just did the revert of commit 984652dd8b1f ("net: remove
sock_no_poll") in my tree.

But I haven't pushed it out, and your patch is certainly smaller/nicer
than the revert.

That said, the revert does have the advantage of avoiding a
conditional in the network poll() function (at the cost of a more
expensive indirect call for when sock_no_poll actually triggers, but
only "odd" network protocols have that).

Hmm. I'll have to think about it.

               Linus

Re: [PATCH 1/2] net: handle NULL ->poll gracefully

From: Linus Torvalds <torvalds@linux-foundation.org>
Date: 2018-06-29 13:54:10

On Fri, Jun 29, 2018 at 6:46 AM Linus Torvalds
[off-list ref] wrote:
Hmm. I'll have to think about it.
I took yours over the revert. It's just smaller and nicer, and the
conditional should predict fine for any case where it might matter.

                Linus

[PATCH 2/2] aio: mark __aio_sigset::sigmask const

From: Christoph Hellwig <hch@lst.de>
Date: 2018-06-29 13:37:42

From: Avi Kivity <redacted>

io_pgetevents() will not change the signal mask. Mark it const
to make it clear and to reduce the need for casts in user code.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Avi Kivity <redacted>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
[hch: reapply the patch that got incorrectly reverted]
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 include/uapi/linux/aio_abi.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/uapi/linux/aio_abi.h b/include/uapi/linux/aio_abi.h
index d4e768d55d14..3c5038b587ba 100644
--- a/include/uapi/linux/aio_abi.h
+++ b/include/uapi/linux/aio_abi.h
@@ -111,7 +111,7 @@ struct iocb {
 #undef IFLITTLE
 
 struct __aio_sigset {
-	sigset_t __user	*sigmask;
+	const sigset_t __user	*sigmask;
 	size_t		sigsetsize;
 };
 
-- 
2.18.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help