Skip to contentSkip to conversation

Fixes for the AIO poll revert

PATCH In review Christoph Hellwig 2 participants 5 messages Jun 29, 2018

Subsystems (4)
lore
Share & tools
lore
#1 lore raw

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

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")
---
 net/socket.c | 2 ++
 1 file changed, 2 insertions(+)
net/socket.c +2 -0
index a564c6ed19d5..85633622c94d 100644
@@ -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);
 }
 
Signature · 1 line
2.18.0
#4 lore raw

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

In reply to Christoph Hellwig

From: Avi Kivity <[email protected]>

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.

[hch: reapply the patch that got incorrectly reverted]
---
 include/uapi/linux/aio_abi.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/aio_abi.h +1 -1
index d4e768d55d14..3c5038b587ba 100644
@@ -111,7 +111,7 @@ struct iocb {
 #undef IFLITTLE
 
 struct __aio_sigset {
-	sigset_t __user	*sigmask;
+	const sigset_t __user	*sigmask;
 	size_t		sigsetsize;
 };
 
Signature · 1 line
2.18.0
#2 lore raw

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

In reply to Christoph Hellwig
Quoted 4 lines · Christoph Hellwig

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

#3 lore raw

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

Quoted 2 lines · Linus Torvalds

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