From owner-freebsd-arch Sun Mar 17 8:42: 0 2002 Delivered-To: freebsd-arch@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 821) id EFF0E37B43D; Sun, 17 Mar 2002 08:41:53 -0800 (PST) Date: Sun, 17 Mar 2002 08:41:53 -0800 From: John De Boskey To: Arch List Subject: ftpd ESTALE recovery patch Message-ID: <20020317084153.A3942@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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