]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
smb: client: let smbd_post_send_full_iter() get remaining_length and return data_length
authorStefan Metzmacher <metze@samba.org>
Fri, 17 Oct 2025 19:03:45 +0000 (21:03 +0200)
committerSteve French <stfrench@microsoft.com>
Thu, 16 Apr 2026 02:58:22 +0000 (21:58 -0500)
This will simplify further changes in order to share
more common code in future.

Cc: Steve French <smfrench@gmail.com>
Cc: Tom Talpey <tom@talpey.com>
Cc: Long Li <longli@microsoft.com>
Cc: Namjae Jeon <linkinjeon@kernel.org>
Cc: linux-cifs@vger.kernel.org
Cc: samba-technical@lists.samba.org
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/smbdirect.c

index 4c19ad453f9346c97f741efd37eb9f7e75a4af0f..ffc6a4b6de39f28764a0b9220eebc6fe9ee1d8d2 100644 (file)
@@ -1163,9 +1163,9 @@ static void smbd_post_send_empty(struct smbdirect_socket *sc)
 static int smbd_post_send_full_iter(struct smbdirect_socket *sc,
                                    struct smbdirect_send_batch *batch,
                                    struct iov_iter *iter,
-                                   int *_remaining_data_length)
+                                   u32 remaining_data_length)
 {
-       int rc = 0;
+       int bytes = 0;
 
        /*
         * smbd_post_send_iter() respects the
@@ -1174,14 +1174,16 @@ static int smbd_post_send_full_iter(struct smbdirect_socket *sc,
         */
 
        while (iov_iter_count(iter) > 0) {
-               rc = smbd_post_send_iter(sc, batch, iter, *_remaining_data_length);
+               int rc;
+
+               rc = smbd_post_send_iter(sc, batch, iter, remaining_data_length);
                if (rc < 0)
-                       break;
-               *_remaining_data_length -= rc;
-               rc = 0;
+                       return rc;
+               remaining_data_length -= rc;
+               bytes += rc;
        }
 
-       return rc;
+       return bytes;
 }
 
 /* Perform SMBD negotiate according to [MS-SMBD] 3.1.5.2 */
@@ -1584,20 +1586,22 @@ int smbd_send(struct TCP_Server_Info *server,
                        klen += rqst->rq_iov[i].iov_len;
                iov_iter_kvec(&iter, ITER_SOURCE, rqst->rq_iov, rqst->rq_nvec, klen);
 
-               rc = smbd_post_send_full_iter(sc, &batch, &iter, &remaining_data_length);
+               rc = smbd_post_send_full_iter(sc, &batch, &iter, remaining_data_length);
                if (rc < 0) {
                        error = rc;
                        break;
                }
+               remaining_data_length -= rc;
 
                if (iov_iter_count(&rqst->rq_iter) > 0) {
                        /* And then the data pages if there are any */
                        rc = smbd_post_send_full_iter(sc, &batch, &rqst->rq_iter,
-                                                     &remaining_data_length);
+                                                     remaining_data_length);
                        if (rc < 0) {
                                error = rc;
                                break;
                        }
+                       remaining_data_length -= rc;
                }
 
        } while (++rqst_idx < num_rqst);