mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] AFS: Use patched rxrpc_kernel_send_data() correctly
@ 2007-07-19 18:06 David Howells
  2007-07-19 21:20 ` Linus Torvalds
  0 siblings, 1 reply; 2+ messages in thread
From: David Howells @ 2007-07-19 18:06 UTC (permalink / raw)
  To: torvalds, akpm; +Cc: linux-kernel, dhowells

Fix afs_send_simple_reply() to accept a greater-than-zero return value from
rxrpc_kernel_send_data() as being a successful return rather than thinking it
an error and aborting the call.

rxrpc_kernel_send_data() previously returned zero incorrectly when it worked
successfully, but has been patched to return the number of bytes it
transmitted.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 fs/afs/rxrpc.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/afs/rxrpc.c b/fs/afs/rxrpc.c
index 1b36f45..3acd08d 100644
--- a/fs/afs/rxrpc.c
+++ b/fs/afs/rxrpc.c
@@ -792,6 +792,7 @@ void afs_send_simple_reply(struct afs_call *call, const void *buf, size_t len)
 {
 	struct msghdr msg;
 	struct iovec iov[1];
+	int n;
 
 	_enter("");
 
@@ -806,8 +807,9 @@ void afs_send_simple_reply(struct afs_call *call, const void *buf, size_t len)
 	msg.msg_flags		= 0;
 
 	call->state = AFS_CALL_AWAIT_ACK;
-	switch (rxrpc_kernel_send_data(call->rxcall, &msg, len)) {
-	case 0:
+	n = rxrpc_kernel_send_data(call->rxcall, &msg, len);
+	switch (n) {
+	case 0 ... INT_MAX:
 		_leave(" [replied]");
 		return;
 


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

* Re: [PATCH] AFS: Use patched rxrpc_kernel_send_data() correctly
  2007-07-19 18:06 [PATCH] AFS: Use patched rxrpc_kernel_send_data() correctly David Howells
@ 2007-07-19 21:20 ` Linus Torvalds
  0 siblings, 0 replies; 2+ messages in thread
From: Linus Torvalds @ 2007-07-19 21:20 UTC (permalink / raw)
  To: David Howells; +Cc: akpm, linux-kernel



On Thu, 19 Jul 2007, David Howells wrote:
>
> @@ -806,8 +807,9 @@ void afs_send_simple_reply(struct afs_call *call, const void *buf, size_t len)
>  	msg.msg_flags		= 0;
>  
>  	call->state = AFS_CALL_AWAIT_ACK;
> -	switch (rxrpc_kernel_send_data(call->rxcall, &msg, len)) {
> -	case 0:
> +	n = rxrpc_kernel_send_data(call->rxcall, &msg, len);
> +	switch (n) {
> +	case 0 ... INT_MAX:
>  		_leave(" [replied]");
>  		return;

Please don't do this. There's no reason to. Why not just use the much 
simpler

	if (n >= 0) {
		_leave(" [replied]");
		return;
	}
	if (n == -ENOMEM) {
		_debug("oom");
		rxrpc_kernel_abort_call(call->rxcall, RX_USER_ABORT);
	}

rather than have a silly and totally pointless case-statement with three 
really odd cases?

			Linus

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

end of thread, other threads:[~2007-07-19 21:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-19 18:06 [PATCH] AFS: Use patched rxrpc_kernel_send_data() correctly David Howells
2007-07-19 21:20 ` Linus Torvalds

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®