Skip to contentSkip to conversation

tun: flag the device as supporting FMODE_NOWAIT

PATCH Applied Jens Axboe 2 participants 2 messages Mar 8, 2023 – Mar 11, 2023

Subsystems (3)
lore
Share & tools
lore

Jens Axboe

author
#0 lore raw

PATCH 1/1 tun: flag the device as supporting FMODE_NOWAIT

tun already checks for both O_NONBLOCK and IOCB_NOWAIT in its read and write iter handlers, so it's fully ready for FMODE_NOWAIT. But for some reason it doesn't set it. Rectify that oversight.

---

drivers/net/tun.c +2 -0
index ad653b32b2f0..4c7f74904c25 100644
@@ -3463,6 +3463,8 @@ static int tun_chr_open(struct inode *inode, struct file * file)
 
 	sock_set_flag(&tfile->sk, SOCK_ZEROCOPY);
 
+	/* tun groks IOCB_NOWAIT just fine, mark it as such */
+	file->f_mode |= FMODE_NOWAIT;
 	return 0;
 }
 
Signature · 1 line
Jens Axboe
#1 lore raw
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Tue, 7 Mar 2023 20:45:56 -0700 you wrote:

tun already checks for both O_NONBLOCK and IOCB_NOWAIT in its read and write iter handlers, so it's fully ready for FMODE_NOWAIT. But for some reason it doesn't set it. Rectify that oversight.

[...]

Here is the summary with links:
- tun: flag the device as supporting FMODE_NOWAIT

    https://git.kernel.org/netdev/net-next/c/438b406055cd

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html