Date: Sun, 17 Mar 2002 08:41:53 -0800 From: John De Boskey <jwd@FreeBSD.org> To: Arch List <freebsd-arch@FreeBSD.org> Subject: ftpd ESTALE recovery patch Message-ID: <20020317084153.A3942@FreeBSD.org>
next in thread | raw e-mail | index | archive | help
Hi, In a busy cluster, a generated file being handed out by ftp is failing due to an ESTALE condition. The following patch fixes the problem. Failure to open the file is also logged when -l is specified twice (see ftpd(8)). We've been running this for some time and I'd like to get it committed. Comments? Thanks! John 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-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020317084153.A3942>