]> www.infradead.org Git - users/hch/misc.git/commitdiff
sunrpc: fix pr_notice in svc_tcp_sendto() to show correct length
authorJeff Layton <jlayton@kernel.org>
Mon, 11 Aug 2025 14:37:07 +0000 (10:37 -0400)
committerChuck Lever <chuck.lever@oracle.com>
Sun, 21 Sep 2025 23:24:50 +0000 (19:24 -0400)
This pr_notice() is confusing since it only prints xdr->len, which
doesn't include the 4-byte record marker.  That can make it sometimes
look like the socket sent more than was requested if it's short by just
a few bytes.

Add sizeof(marker) to the size and fix the format accordingly.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
net/sunrpc/svcsock.c

index e2c5e0e626f9484490bd12c59941a69bda93ac3e..1afaeb45d6a37a5bf98ea2cda1ea36174ae03c85 100644 (file)
@@ -1293,10 +1293,10 @@ out_notconn:
        mutex_unlock(&xprt->xpt_mutex);
        return -ENOTCONN;
 out_close:
-       pr_notice("rpc-srv/tcp: %s: %s %d when sending %d bytes - shutting down socket\n",
+       pr_notice("rpc-srv/tcp: %s: %s %d when sending %zu bytes - shutting down socket\n",
                  xprt->xpt_server->sv_name,
                  (err < 0) ? "got error" : "sent",
-                 (err < 0) ? err : sent, xdr->len);
+                 (err < 0) ? err : sent, xdr->len + sizeof(marker));
        svc_xprt_deferred_close(xprt);
        mutex_unlock(&xprt->xpt_mutex);
        return -EAGAIN;