summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Kelly <mike@weatherwax.co.uk>2025-07-13 12:45:50 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2025-07-13 12:45:50 +0200
commit84caaeb826ea6c5e8bfb30ea74c67401c220f324 (patch)
tree154094c1abd689366270d8d806731e24d1177f0f
parent4afacc9d804dbc3ecad555fddd6e5f81ed34bb86 (diff)
nfs: Fixes netfs_attempt_read() for nfsv3
Use the 64 bit value required for v3 'offset' and process opaque_data part of the reply properly.
-rw-r--r--nfs/ops.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/nfs/ops.c b/nfs/ops.c
index 3956cafc..a9c4da49 100644
--- a/nfs/ops.c
+++ b/nfs/ops.c
@@ -526,10 +526,17 @@ netfs_attempt_read (struct iouser *cred, struct node *np,
return errno;
p = xdr_encode_fhandle (p, &np->nn->handle);
- *(p++) = htonl (offset);
- *(p++) = htonl (thisamt);
if (protocol_version == 2)
- *(p++) = 0;
+ {
+ *(p++) = htonl (offset);
+ *(p++) = htonl (thisamt);
+ *(p++) = 0;
+ }
+ else
+ {
+ p = xdr_encode_64bit (p, offset);
+ *(p++) = htonl (thisamt);
+ }
err = conduct_rpc (&rpcbuf, &p);
if (!err)
@@ -553,8 +560,15 @@ netfs_attempt_read (struct iouser *cred, struct node *np,
if (protocol_version == 3)
{
+ size_t opaque_data_len;
+
eof = ntohl (*p);
p++;
+ opaque_data_len = ntohl (*p++);
+
+ /* opaque_len should surely equal trans_len, however... */
+ if (opaque_data_len < trans_len)
+ trans_len = opaque_data_len;
}
else
eof = (trans_len < thisamt);