lkml.org 
[lkml]   [1998]   [Feb]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subjectminor patch for 2.1.85 NFS client
The attached patch is in response to a reported problem with writes failing on a
SysV server. The problem turned out to be that some servers expect the length of
the RPC message to be a multiple of 4, and the new more efficient RPC interface
doesn't copy the data and add padding.

My workaround is to check whether padding is needed and put in an extra iovec
with the required number of null bytes. (Just extending the length of the count
for the data buffer might access beyond the page end.)

There was one other report of NFS writes failing with a "garbage args" problem,
with a UnixWare server IIRC. If that person could test this patch and let me
know, I'd appreciate it.

Regards,
Bill--- fs/nfs/nfs2xdr.c.old Tue Jan 27 09:36:34 1998
+++ fs/nfs/nfs2xdr.c Wed Feb 4 15:10:59 1998
@@ -258,6 +258,8 @@
static int
nfs_xdr_writeargs(struct rpc_rqst *req, u32 *p, struct nfs_writeargs *args)
{
+ int pad;
+
p = xdr_encode_fhandle(p, args->fh);
*p++ = htonl(args->offset);
*p++ = htonl(args->offset);
@@ -269,6 +271,18 @@
req->rq_svec[1].iov_len = args->count;
req->rq_slen += args->count;
req->rq_snr = 2;
+
+ /*
+ * Kludge-o-Rama: Some old servers don't like message lengths
+ * that aren't a multiple of 4. Pad it out here if needed ...
+ */
+ pad = ((args->count + 3) & ~3) - args->count;
+ if (pad) {
+ req->rq_svec[2].iov_base = (void *) "\0\0\0";
+ req->rq_svec[2].iov_len = pad;
+ req->rq_slen += pad;
+ req->rq_snr = 3;
+ }

return 0;
}
\
 
 \ /
  Last update: 2005-03-22 13:41    [W:0.027 / U:0.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site