Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Stefan Metzmacher <metze@samba.org>
Cc: dhowells@redhat.com, linux-cifs@vger.kernel.org,
	Steve French <sfrench@samba.org>, Tom Talpey <tom@talpey.com>
Subject: Re: [PATCH 2/2] smb: client: let smbd_post_send_iter() respect the peers max_send_size and transmit all data
Date: Thu, 19 Jun 2025 12:49:00 +0100	[thread overview]
Message-ID: <850317.1750333740@warthog.procyon.org.uk> (raw)
In-Reply-To: <8ecf5dc585af7abb37f3fabac6eb0f9f3273da85.1750264849.git.metze@samba.org>

Stefan Metzmacher <metze@samba.org> wrote:

> diff --git a/fs/smb/client/smbdirect.c b/fs/smb/client/smbdirect.c
> index cbc85bca006f..3a41dcbbff81 100644
> --- a/fs/smb/client/smbdirect.c
> +++ b/fs/smb/client/smbdirect.c
> @@ -842,7 +842,7 @@ static int smbd_post_send(struct smbd_connection *info,
>  
>  static int smbd_post_send_iter(struct smbd_connection *info,
>  			       struct iov_iter *iter,
> -			       int *_remaining_data_length)
> +			       unsigned int *_remaining_data_length)

I would recommend size_t...

>  {
>  	struct smbdirect_socket *sc = &info->socket;
>  	struct smbdirect_socket_parameters *sp = &sc->parameters;
> @@ -907,8 +907,10 @@ static int smbd_post_send_iter(struct smbd_connection *info,
>  			.local_dma_lkey	= sc->ib.pd->local_dma_lkey,
>  			.direction	= DMA_TO_DEVICE,
>  		};
> +		size_t payload_len = min_t(size_t, *_remaining_data_length,
> +					   sp->max_send_size - sizeof(*packet));

... and umin().

>  
> -		rc = smb_extract_iter_to_rdma(iter, *_remaining_data_length,
> +		rc = smb_extract_iter_to_rdma(iter, payload_len,
>  					      &extract);
>  		if (rc < 0)
>  			goto err_dma;
> @@ -970,8 +972,16 @@ static int smbd_post_send_iter(struct smbd_connection *info,
>  	request->sge[0].lkey = sc->ib.pd->local_dma_lkey;
>  
>  	rc = smbd_post_send(info, request);
> -	if (!rc)
> +	if (!rc) {
> +		if (iter && iov_iter_count(iter) > 0) {
> +			/*
> +			 * There is more data to send
> +			 */
> +			goto wait_credit;
> +		}
> +

This fix isn't mentioned in the patch description.

>  		return 0;
> +	}
>  
>  err_dma:
>  	for (i = 0; i < request->num_sge; i++)
> @@ -1007,7 +1017,7 @@ static int smbd_post_send_iter(struct smbd_connection *info,
>   */
>  static int smbd_post_send_empty(struct smbd_connection *info)
>  {
> -	int remaining_data_length = 0;
> +	unsigned int remaining_data_length = 0;

size_t?

>  
>  	info->count_send_empty++;
>  	return smbd_post_send_iter(info, NULL, &remaining_data_length);

Apart from the above:

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


  reply	other threads:[~2025-06-19 11:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-18 16:51 [PATCH 0/2] smb: client: fix problems with smbdirect/rdma mounts Stefan Metzmacher
2025-06-18 16:51 ` [PATCH 1/2] smb: client: fix max_sge overflow in smb_extract_folioq_to_rdma() Stefan Metzmacher
2025-06-19 11:41   ` David Howells
2025-06-19 19:07     ` Tom Talpey
2025-06-18 16:51 ` [PATCH 2/2] smb: client: let smbd_post_send_iter() respect the peers max_send_size and transmit all data Stefan Metzmacher
2025-06-19 11:49   ` David Howells [this message]
2025-06-19 19:22   ` Tom Talpey
2025-06-20 12:29     ` David Howells
2025-06-20 13:33       ` Tom Talpey
2025-06-20 14:56         ` David Howells
2025-06-25  7:59       ` David Howells
2025-06-23 15:46     ` Stefan Metzmacher
2025-06-23 17:28       ` Steve French
2025-06-23 19:48         ` Sasha Levin
2025-06-25  8:00   ` David Howells

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=850317.1750333740@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=metze@samba.org \
    --cc=sfrench@samba.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox