net: provide __sys_shutdown_sock() that takes a socket
Subsystems (3)
PATCH 1/1 net: provide __sys_shutdown_sock() that takes a socket
No functional changes in this patch, needed to provide io_uring support for shutdown(2).
---
There's a trivial io_uring patch that depends on this one. If this one is acceptable to you, I'd like to queue it up in the io_uring branch for 5.10.
include/linux/socket.h +1 -0
@@ -436,6 +436,7 @@ extern int __sys_getpeername(int fd, struct sockaddr __user *usockaddr, int __user *usockaddr_len);extern int __sys_socketpair (int family,int type,int protocol,int __user *usockvec); +extern int __sys_shutdown_sock (struct socket *sock,int how);extern int __sys_shutdown (int fd,int how);extern struct ns_common *get_net_ns (struct ns_common *ns);
net/socket.c +12 -3
@@ -2192,6 +2192,17 @@ SYSCALL_DEFINE5(getsockopt, int, fd, int, level, int, optname,* Shutdown a socket. */ +int __sys_shutdown_sock (struct socket *sock,int how) +{ +int err; + + err =security_socket_shutdown (sock, how); +if (!err) + err = sock->ops->shutdown (sock, how); + +return err; +} +int __sys_shutdown (int fd,int how) {int err, fput_needed;
@@ -2199,9 +2210,7 @@ int __sys_shutdown(int fd, int how) sock =sockfd_lookup_light (fd, &err, &fput_needed);if (sock !=NULL ) { - err =security_socket_shutdown (sock, how); -if (!err) - err = sock->ops->shutdown (sock, how); + err =__sys_shutdown_sock (sock, how);fput_light (sock->file, fput_needed); }return err;
Signature · 1 line
Jens Axboe
Quoted 7 lines · On Sat, 5 Sep 2020 16:05:48 -0600 Jens Axboe wrote:
No functional changes in this patch, needed to provide
io_uringsupport for shutdown(2).Cc David S. Miller <[email protected]>Signed-off-by Jens Axboe <[email protected]>
Quoted 5 lines
---
There's a trivial
io_uringpatch that depends on this one. If this one is acceptable to you, I'd like to queue it up in theio_uringbranch for 5.10.
Go for it.
Quoted 10 lines · Jakub Kicinski
Quoted 9 lines · On Sat, 5 Sep 2020 16:05:48 -0600 Jens Axboe wrote:
No functional changes in this patch, needed to provide
io_uringsupport for shutdown(2).Cc David S. Miller <[email protected]>Signed-off-by Jens Axboe <[email protected]>---
Quoted 7 lines
Quoted 3 lines
There's a trivial
io_uringpatch that depends on this one. If this one is acceptable to you, I'd like to queue it up in theio_uringbranch for 5.10.Go for it.
Acked-by Jakub Kicinski <[email protected]>
Thanks! Added your Acked-by.
Signature · 1 line
Jens Axboe
Quoted 3 lines · Jens Axboe
There's a trivial
io_uringpatch that depends on this one. If this one is acceptable to you, I'd like to queue it up in theio_uringbranch for 5.10.
Can you give it a better name? These __ names re just horrible. sock_shutdown_sock?
Quoted 7 lines · Christoph Hellwig
Quoted 3 lines · Jens Axboe
There's a trivial
io_uringpatch that depends on this one. If this one is acceptable to you, I'd like to queue it up in theio_uringbranch for 5.10.Can you give it a better name? These __ names re just horrible.
sock_shutdown_sock?
Sure, I don't really care, just following what is mostly done already. And it is meant to be internal in the sense that it's not exported to modules.
I'll let the net guys pass the final judgement on that, I'm obviously fine with anything in terms of naming :-)
Signature · 1 line
Jens Axboe
Jakub Kicinski
maintainerQuoted 6 lines · On Mon, 7 Sep 2020 10:45:00 -0600 Jens Axboe wrote:
Quoted 5 lines · Christoph Hellwig
Quoted 3 lines · Jens Axboe
There's a trivial
io_uringpatch that depends on this one. If this one is acceptable to you, I'd like to queue it up in theio_uringbranch for 5.10.
Quoted 8 lines
Quoted 2 lines
Can you give it a better name? These __ names re just horrible.
sock_shutdown_sock?Sure, I don't really care, just following what is mostly done already. And it is meant to be internal in the sense that it's not exported to modules.
I'll let the net guys pass the final judgement on that, I'm obviously fine with anything in terms of naming :-)
So am I :) But if Christoph prefers sock_shutdown_sock() let's use that.
Quoted 10 lines · Jakub Kicinski
Quoted 9 lines · On Mon, 7 Sep 2020 10:45:00 -0600 Jens Axboe wrote:
Quoted 7 lines · Christoph Hellwig
Quoted 3 lines · Jens Axboe
There's a trivial
io_uringpatch that depends on this one. If this one is acceptable to you, I'd like to queue it up in theio_uringbranch for 5.10.Can you give it a better name? These __ names re just horrible.
sock_shutdown_sock?
Quoted 7 lines
Quoted 5 lines
Sure, I don't really care, just following what is mostly done already. And it is meant to be internal in the sense that it's not exported to modules.
I'll let the net guys pass the final judgement on that, I'm obviously fine with anything in terms of naming :-)
So am I :) But if Christoph prefers
sock_shutdown_sock()let's use that.
Let's go with the original naming. I might eventually do a big naming sweep in socket.c after cleaning up more of the compat mess.
Quoted 14 lines · Christoph Hellwig
Quoted 13 lines · Jakub Kicinski
Quoted 12 lines · On Mon, 7 Sep 2020 10:45:00 -0600 Jens Axboe wrote:
Quoted 7 lines · Christoph Hellwig
Quoted 3 lines · Jens Axboe
There's a trivial
io_uringpatch that depends on this one. If this one is acceptable to you, I'd like to queue it up in theio_uringbranch for 5.10.Can you give it a better name? These __ names re just horrible.
sock_shutdown_sock?Sure, I don't really care, just following what is mostly done already. And it is meant to be internal in the sense that it's not exported to modules.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
I'll let the net guys pass the final judgement on that, I'm obviously fine with anything in terms of naming :-)
So am I :) But if Christoph prefers
sock_shutdown_sock()let's use that.Let's go with the original naming. I might eventually do a big naming sweep in
socket.cafter cleaning up more of the compat mess.
Agree, saves me the hassle... FWIW, networking does have an even broader space of func to __func to ____func and in some cases not "following" the usual calling order of them.
Signature · 1 line
Jens Axboe