All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH for-next] net: provide __sys_shutdown_sock() that takes a socket
@ 2020-09-05 22:05 Jens Axboe
  2020-09-05 22:39 ` Jakub Kicinski
  2020-09-07  5:48 ` Christoph Hellwig
  0 siblings, 2 replies; 8+ messages in thread
From: Jens Axboe @ 2020-09-05 22:05 UTC (permalink / raw)
  To: Networking; +Cc: David S. Miller

No functional changes in this patch, needed to provide io_uring support
for shutdown(2).

Cc: netdev@vger.kernel.org
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

---

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.

diff --git a/include/linux/socket.h b/include/linux/socket.h
index e9cb30d8cbfb..385894b4a8bb 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -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);
diff --git a/net/socket.c b/net/socket.c
index dbbe8ea7d395..59307db6097e 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -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;

-- 
Jens Axboe


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH for-next] net: provide __sys_shutdown_sock() that takes a socket
  2020-09-05 22:05 [PATCH for-next] net: provide __sys_shutdown_sock() that takes a socket Jens Axboe
@ 2020-09-05 22:39 ` Jakub Kicinski
  2020-09-05 22:51   ` Jens Axboe
  2020-09-07  5:48 ` Christoph Hellwig
  1 sibling, 1 reply; 8+ messages in thread
From: Jakub Kicinski @ 2020-09-05 22:39 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Networking, David S. Miller

On Sat, 5 Sep 2020 16:05:48 -0600 Jens Axboe wrote:
> No functional changes in this patch, needed to provide io_uring support
> for shutdown(2).
> 
> Cc: netdev@vger.kernel.org
> Cc: David S. Miller <davem@davemloft.net>
> Signed-off-by: Jens Axboe <axboe@kernel.dk>
> 
> ---
> 
> 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.

Go for it.

Acked-by: Jakub Kicinski <kuba@kernel.org>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH for-next] net: provide __sys_shutdown_sock() that takes a socket
  2020-09-05 22:39 ` Jakub Kicinski
@ 2020-09-05 22:51   ` Jens Axboe
  0 siblings, 0 replies; 8+ messages in thread
From: Jens Axboe @ 2020-09-05 22:51 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: Networking, David S. Miller

On 9/5/20 4:39 PM, Jakub Kicinski wrote:
> On Sat, 5 Sep 2020 16:05:48 -0600 Jens Axboe wrote:
>> No functional changes in this patch, needed to provide io_uring support
>> for shutdown(2).
>>
>> Cc: netdev@vger.kernel.org
>> Cc: David S. Miller <davem@davemloft.net>
>> Signed-off-by: Jens Axboe <axboe@kernel.dk>
>>
>> ---
>>
>> 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.
> 
> Go for it.
> 
> Acked-by: Jakub Kicinski <kuba@kernel.org>

Thanks! Added your Acked-by.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH for-next] net: provide __sys_shutdown_sock() that takes a socket
  2020-09-05 22:05 [PATCH for-next] net: provide __sys_shutdown_sock() that takes a socket Jens Axboe
  2020-09-05 22:39 ` Jakub Kicinski
@ 2020-09-07  5:48 ` Christoph Hellwig
  2020-09-07 16:45   ` Jens Axboe
  1 sibling, 1 reply; 8+ messages in thread
From: Christoph Hellwig @ 2020-09-07  5:48 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Networking, David S. Miller

On Sat, Sep 05, 2020 at 04:05:48PM -0600, Jens Axboe wrote:
> 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.

Can you give it a better name?  These __ names re just horrible.
sock_shutdown_sock?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH for-next] net: provide __sys_shutdown_sock() that takes a socket
  2020-09-07  5:48 ` Christoph Hellwig
@ 2020-09-07 16:45   ` Jens Axboe
  2020-09-07 16:58     ` Jakub Kicinski
  0 siblings, 1 reply; 8+ messages in thread
From: Jens Axboe @ 2020-09-07 16:45 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Networking, David S. Miller

On 9/6/20 11:48 PM, Christoph Hellwig wrote:
> On Sat, Sep 05, 2020 at 04:05:48PM -0600, Jens Axboe wrote:
>> 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.
> 
> 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 :-)

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH for-next] net: provide __sys_shutdown_sock() that takes a socket
  2020-09-07 16:45   ` Jens Axboe
@ 2020-09-07 16:58     ` Jakub Kicinski
  2020-09-07 17:00       ` Christoph Hellwig
  0 siblings, 1 reply; 8+ messages in thread
From: Jakub Kicinski @ 2020-09-07 16:58 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Christoph Hellwig, Networking, David S. Miller

On Mon, 7 Sep 2020 10:45:00 -0600 Jens Axboe wrote:
> On 9/6/20 11:48 PM, Christoph Hellwig wrote:
> > On Sat, Sep 05, 2020 at 04:05:48PM -0600, Jens Axboe wrote:  
> >> 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.  
> > 
> > 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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH for-next] net: provide __sys_shutdown_sock() that takes a socket
  2020-09-07 16:58     ` Jakub Kicinski
@ 2020-09-07 17:00       ` Christoph Hellwig
  2020-09-07 19:32         ` Jens Axboe
  0 siblings, 1 reply; 8+ messages in thread
From: Christoph Hellwig @ 2020-09-07 17:00 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: Jens Axboe, Christoph Hellwig, Networking, David S. Miller

On Mon, Sep 07, 2020 at 09:58:13AM -0700, Jakub Kicinski wrote:
> On Mon, 7 Sep 2020 10:45:00 -0600 Jens Axboe wrote:
> > On 9/6/20 11:48 PM, Christoph Hellwig wrote:
> > > On Sat, Sep 05, 2020 at 04:05:48PM -0600, Jens Axboe wrote:  
> > >> 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.  
> > > 
> > > 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.

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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH for-next] net: provide __sys_shutdown_sock() that takes a socket
  2020-09-07 17:00       ` Christoph Hellwig
@ 2020-09-07 19:32         ` Jens Axboe
  0 siblings, 0 replies; 8+ messages in thread
From: Jens Axboe @ 2020-09-07 19:32 UTC (permalink / raw)
  To: Christoph Hellwig, Jakub Kicinski; +Cc: Networking, David S. Miller

On 9/7/20 11:00 AM, Christoph Hellwig wrote:
> On Mon, Sep 07, 2020 at 09:58:13AM -0700, Jakub Kicinski wrote:
>> On Mon, 7 Sep 2020 10:45:00 -0600 Jens Axboe wrote:
>>> On 9/6/20 11:48 PM, Christoph Hellwig wrote:
>>>> On Sat, Sep 05, 2020 at 04:05:48PM -0600, Jens Axboe wrote:  
>>>>> 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.  
>>>>
>>>> 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.
> 
> 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.

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.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-09-07 19:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-05 22:05 [PATCH for-next] net: provide __sys_shutdown_sock() that takes a socket Jens Axboe
2020-09-05 22:39 ` Jakub Kicinski
2020-09-05 22:51   ` Jens Axboe
2020-09-07  5:48 ` Christoph Hellwig
2020-09-07 16:45   ` Jens Axboe
2020-09-07 16:58     ` Jakub Kicinski
2020-09-07 17:00       ` Christoph Hellwig
2020-09-07 19:32         ` Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.