All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <senozhatsky@chromium.org>
To: Namjae Jeon <linkinjeon@kernel.org>
Cc: linux-cifs@vger.kernel.org, smfrench@gmail.com,
	senozhatsky@chromium.org, tom@talpey.com,
	atteh.mailbox@gmail.com, Steve French <stfrench@microsoft.com>
Subject: Re: [PATCH] ksmbd: don't terminate inactive sessions after a few seconds
Date: Fri, 24 Mar 2023 12:50:00 +0900	[thread overview]
Message-ID: <20230324035000.GD3271889@google.com> (raw)
In-Reply-To: <20230321133312.103789-1-linkinjeon@kernel.org>

On (23/03/21 22:33), Namjae Jeon wrote:
[..]
> @@ -335,14 +336,23 @@ static int ksmbd_tcp_readv(struct tcp_transport *t, struct kvec *iov_orig,
>  		} else if (conn->status == KSMBD_SESS_NEED_RECONNECT) {
>  			total_read = -EAGAIN;
>  			break;
> -		} else if ((length == -ERESTARTSYS || length == -EAGAIN) &&
> -			   max_retry) {
> +		} else if (length == -ERESTARTSYS || length == -EAGAIN) {
> +			/*
> +			 * If max_retries is negative, Allow unlimited
> +			 * retries to keep connection with inactive sessions.
> +			 */
> +			if (max_retries == 0) {
> +				total_read = length;
> +				break;
> +			} else if (max_retries > 0) {
> +				max_retries--;
> +			}
> +
>  			usleep_range(1000, 2000);
>  			length = 0;
> -			max_retry--;
>  			continue;
>  		} else if (length <= 0) {
> -			total_read = -EAGAIN;
> +			total_read = length;
>  			break;
>  		}
>  	}

By the way, ksmbd_tcp_readv() calls kvec_array_init() on each iteration.
Shouldn't we call it only if length > 0? That is only if the most recent
call to kernel_recvmsg() has read some data.

  parent reply	other threads:[~2023-03-24  3:50 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-21 13:33 [PATCH] ksmbd: don't terminate inactive sessions after a few seconds Namjae Jeon
2023-03-21 13:33 ` [PATCH] ksmbd: return STATUS_NOT_SUPPORTED on unsupported smb2.0 dialect Namjae Jeon
2023-03-21 13:33 ` [PATCH] ksmbd: return unsupported error on smb1 mount Namjae Jeon
2023-03-23  2:53   ` Sergey Senozhatsky
2023-03-23  4:10     ` Namjae Jeon
2023-03-23  5:00       ` Sergey Senozhatsky
2023-03-23  5:04         ` Namjae Jeon
2023-03-23  5:17           ` [PATCH v2] " Namjae Jeon
2023-03-24  3:44             ` Sergey Senozhatsky
2023-03-24  3:50 ` Sergey Senozhatsky [this message]
2023-03-24  4:28   ` [PATCH] ksmbd: don't terminate inactive sessions after a few seconds Namjae Jeon
2023-03-24  5:45     ` Sergey Senozhatsky
2023-03-24  7:00       ` Namjae Jeon
2023-03-24  5:43 ` Sergey Senozhatsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230324035000.GD3271889@google.com \
    --to=senozhatsky@chromium.org \
    --cc=atteh.mailbox@gmail.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=smfrench@gmail.com \
    --cc=stfrench@microsoft.com \
    --cc=tom@talpey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.