Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 3 Mar 2002 05:49:48 -0800
From:      John <jwd@FreeBSD.org>
To:        Current List <freebsd-current@FreeBSD.org>
Subject:   ftpd ESTALE patch
Message-ID:  <20020303054948.A29473@FreeBSD.org>

next in thread | raw e-mail | index | archive | help
Hi,

   I've had the following patch installed for some time
now.

   Basically, we ran into a situation where files being
generated/stored to a fileserver from client A and then
handed by out by ftp from a different client host was failing.

   The following patch handles the recoverable ESTALE
situation. Trace/debug output is done when the logging
level is 2 or more as is done elsewhere.

   It is also worth noting that ESTALE is not documented
as a valid errno return from open().

Thanks,
John

The patch can also be found online at:

http://people.freebsd.org/~jwd/ftpd.estale.patch


Index: ftpd.c
===================================================================
RCS file: /home/ncvs/src/libexec/ftpd/ftpd.c,v
retrieving revision 1.99
diff -u -r1.99 ftpd.c
--- ftpd.c	25 Feb 2002 16:39:34 -0000	1.99
+++ ftpd.c	3 Mar 2002 13:25:00 -0000
@@ -1478,7 +1478,15 @@
 	time_t start;
 
 	if (cmd == 0) {
-		fin = fopen(name, "r"), closefunc = fclose;
+		int try = 0;
+		while ((fin = fopen(name,"r")) == NULL && errno == ESTALE && try < 3 ) {
+			sleep(++try);
+			if (logging > 1)
+				syslog(LOG_INFO,"get fopen(\"%s\"): %m: attempting retry",name);
+		}
+		if (fin == NULL && logging > 1)
+			syslog(LOG_INFO,"get fopen(\"%s\"): %m",name);   
+		closefunc = fclose;
 		st.st_size = 0;
 	} else {
 		char line[BUFSIZ];



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020303054948.A29473>