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
--------------CD4FE585A2C0704762EFB1C7
Content-Type: text/plain; charset=us-ascii; name="nfs_xdr85-patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="nfs_xdr85-patch"
--- 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;
}
--------------CD4FE585A2C0704762EFB1C7--