public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
* sunrpc patch that fixes nfs-server failure when reading files of specific sizes
@ 2013-11-04 10:52 George Prekas
  2013-11-04 12:22 ` marco atzeri
  0 siblings, 1 reply; 3+ messages in thread
From: George Prekas @ 2013-11-04 10:52 UTC (permalink / raw)
  To: cygwin-apps

[-- Attachment #1: Type: text/plain, Size: 755 bytes --]

Nfs-server occasionally fails when serving files of specific sizes. The Linux client reports an input/output error and the user has to umount and mount the NFS share in order to continue using it.

The problem happens when the file's size is: 8192*k + 3896 or 8192*k + 3896 + 3996 where k = 0,1,2,...

Example file sizes are: 3896, 7892, 12088, 16084

Sunrpc sends data in chunks and under some conditions it fails to recognize that it is sending the last chunk and does not set the corresponding flag (last fragment bit).

The procedure to apply the patch is the following:
* Download source packages nfs-server and sunrpc.
* Execute fix_xdrrec_putbytes.sh

--
George Prekas
Dipl. Electrical and Computer Engineer, National Technical University of Athens

[-- Attachment #2: fix_xdrrec_putbytes.sh --]
[-- Type: application/x-sh, Size: 236 bytes --]

[-- Attachment #3: fix_compile.patch.bin --]
[-- Type: application/octet-stream, Size: 505 bytes --]

--- a/etc/portmap.c
+++ b/etc/portmap.c
@@ -52,7 +52,6 @@ static	char sccsid[] = "@(#)portmap.c 1.32 87/08/06 Copyr 1984 Sun Micro";
 
 static callit();
 
-char *malloc();
 int reg_service();
 void reap();
 struct pmaplist *pmaplist;
diff --git a/rpc/xdr.c b/rpc/xdr.c
index e9c8382..f370b10 100644
--- a/rpc/xdr.c
+++ b/rpc/xdr.c
@@ -42,7 +42,6 @@ static char sccsid[] = "@(#)xdr.c 1.35 87/08/12";
  */
 
 #include <stdio.h>
-char *malloc();
 
 #include <rpc/types.h>
 #include <rpc/xdr.h>

[-- Attachment #4: fix_xdrrec_putbytes.patch.bin --]
[-- Type: application/octet-stream, Size: 696 bytes --]

--- a/rpc/xdr_rec.c
+++ b/rpc/xdr_rec.c
@@ -277,17 +277,17 @@ xdrrec_putbytes(xdrs, addr, len)
 	register int current;
 
 	while (len > 0) {
+		if (rstrm->out_finger == rstrm->out_boundry) {
+			rstrm->frag_sent = TRUE;
+			if (! flush_out(rstrm, FALSE))
+				return (FALSE);
+		}
 		current = (u_int)rstrm->out_boundry - (u_int)rstrm->out_finger;
 		current = (len < current) ? len : current;
 		bcopy(addr, rstrm->out_finger, current);
 		rstrm->out_finger += current;
 		addr += current;
 		len -= current;
-		if (rstrm->out_finger == rstrm->out_boundry) {
-			rstrm->frag_sent = TRUE;
-			if (! flush_out(rstrm, FALSE))
-				return (FALSE);
-		}
 	}
 	return (TRUE);
 }

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-11-04 15:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-04 10:52 sunrpc patch that fixes nfs-server failure when reading files of specific sizes George Prekas
2013-11-04 12:22 ` marco atzeri
2013-11-04 15:03   ` Charles Wilson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).