Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7c3da7d0 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'rprpc-2nd-rewrite-part-1'



David Howells says:

====================
RxRPC: 2nd rewrite part 1

Okay, I'm in the process of rewriting the RxRPC rewrite.  The primary aim of
this second rewrite is to strictly control the number of active connections we
know about and to get rid of connections we don't need much more quickly.

On top of this, there are fixes to the protocol handling which will all occur
in later parts.

Here's the first set of patches from the second go, aimed at net-next.  These
are all fixes and cleanups preparatory to the main event.

Notable parts of this set include:

 (1) A fix for the AFS filesystem to wait for outstanding calls to complete
     before closing the RxRPC socket.

 (2) Differentiation of local and remote abort codes.  At a future point
     userspace will get to see this via control message data on recvmsg().

 (3) Absorb the rxkad module into the af_rxrpc module to prevent a dependency
     loop.

 (4) Create a null security module and unconditionalise calls into the
     security module that's in force (there will always be a security module
     applied to a connection, even if it's just the null one).
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents c64a73d5 e0e4d82f
Loading
Loading
Loading
Loading
+24 −6
Original line number Diff line number Diff line
@@ -65,6 +65,12 @@ static void afs_async_workfn(struct work_struct *work)
	call->async_workfn(call);
}

static int afs_wait_atomic_t(atomic_t *p)
{
	schedule();
	return 0;
}

/*
 * open an RxRPC socket and bind it to be a server for callback notifications
 * - the socket is left in blocking mode and non-blocking ops use MSG_DONTWAIT
@@ -126,13 +132,16 @@ void afs_close_socket(void)
{
	_enter("");

	wait_on_atomic_t(&afs_outstanding_calls, afs_wait_atomic_t,
			 TASK_UNINTERRUPTIBLE);
	_debug("no outstanding calls");

	sock_release(afs_socket);

	_debug("dework");
	destroy_workqueue(afs_async_calls);

	ASSERTCMP(atomic_read(&afs_outstanding_skbs), ==, 0);
	ASSERTCMP(atomic_read(&afs_outstanding_calls), ==, 0);
	_leave("");
}

@@ -178,8 +187,6 @@ static void afs_free_call(struct afs_call *call)
{
	_debug("DONE %p{%s} [%d]",
	       call, call->type->name, atomic_read(&afs_outstanding_calls));
	if (atomic_dec_return(&afs_outstanding_calls) == -1)
		BUG();

	ASSERTCMP(call->rxcall, ==, NULL);
	ASSERT(!work_pending(&call->async_work));
@@ -188,6 +195,9 @@ static void afs_free_call(struct afs_call *call)

	kfree(call->request);
	kfree(call);

	if (atomic_dec_and_test(&afs_outstanding_calls))
		wake_up_atomic_t(&afs_outstanding_calls);
}

/*
@@ -420,9 +430,11 @@ int afs_make_call(struct in_addr *addr, struct afs_call *call, gfp_t gfp,
}

/*
 * handles intercepted messages that were arriving in the socket's Rx queue
 * - called with the socket receive queue lock held to ensure message ordering
 * - called with softirqs disabled
 * Handles intercepted messages that were arriving in the socket's Rx queue.
 *
 * Called from the AF_RXRPC call processor in waitqueue process context.  For
 * each call, it is guaranteed this will be called in order of packet to be
 * delivered.
 */
static void afs_rx_interceptor(struct sock *sk, unsigned long user_call_ID,
			       struct sk_buff *skb)
@@ -513,6 +525,12 @@ static void afs_deliver_to_call(struct afs_call *call)
			call->state = AFS_CALL_ABORTED;
			_debug("Rcv ABORT %u -> %d", abort_code, call->error);
			break;
		case RXRPC_SKB_MARK_LOCAL_ABORT:
			abort_code = rxrpc_kernel_get_abort_code(skb);
			call->error = call->type->abort_to_error(abort_code);
			call->state = AFS_CALL_ABORTED;
			_debug("Loc ABORT %u -> %d", abort_code, call->error);
			break;
		case RXRPC_SKB_MARK_NET_ERROR:
			call->error = -rxrpc_kernel_get_error_number(skb);
			call->state = AFS_CALL_ERROR;
+3 −1
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@
#ifndef _NET_RXRPC_H
#define _NET_RXRPC_H

#include <linux/skbuff.h>
#include <linux/rxrpc.h>

struct rxrpc_call;
@@ -19,11 +20,12 @@ struct rxrpc_call;
/*
 * the mark applied to socket buffers that may be intercepted
 */
enum {
enum rxrpc_skb_mark {
	RXRPC_SKB_MARK_DATA,		/* data message */
	RXRPC_SKB_MARK_FINAL_ACK,	/* final ACK received message */
	RXRPC_SKB_MARK_BUSY,		/* server busy message */
	RXRPC_SKB_MARK_REMOTE_ABORT,	/* remote abort message */
	RXRPC_SKB_MARK_LOCAL_ABORT,	/* local abort message */
	RXRPC_SKB_MARK_NET_ERROR,	/* network error message */
	RXRPC_SKB_MARK_LOCAL_ERROR,	/* local error message */
	RXRPC_SKB_MARK_NEW_CALL,	/* local error message */
+0 −2
Original line number Diff line number Diff line
@@ -68,8 +68,6 @@ struct rxrpc_wire_header {

} __packed;

extern const char *rxrpc_pkts[];

#define RXRPC_SUPPORTED_PACKET_TYPES (			\
		(1 << RXRPC_PACKET_TYPE_DATA) |		\
		(1 << RXRPC_PACKET_TYPE_ACK) |		\
+1 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ config AF_RXRPC_DEBUG


config RXKAD
	tristate "RxRPC Kerberos security"
	bool "RxRPC Kerberos security"
	depends on AF_RXRPC
	select CRYPTO
	select CRYPTO_MANAGER
+4 −3
Original line number Diff line number Diff line
@@ -18,11 +18,12 @@ af-rxrpc-y := \
	ar-recvmsg.o \
	ar-security.o \
	ar-skbuff.o \
	ar-transport.o
	ar-transport.o \
	insecure.o \
	misc.o

af-rxrpc-$(CONFIG_PROC_FS) += ar-proc.o
af-rxrpc-$(CONFIG_RXKAD) += rxkad.o
af-rxrpc-$(CONFIG_SYSCTL) += sysctl.o

obj-$(CONFIG_AF_RXRPC) += af-rxrpc.o

obj-$(CONFIG_RXKAD) += rxkad.o
Loading