Re: [PATCH] ksmbd: don't terminate inactive sessions after a few seconds

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.



[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux