From owner-freebsd-hackers@FreeBSD.ORG Fri Jun 20 02:14:39 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C649837B401; Fri, 20 Jun 2003 02:14:39 -0700 (PDT) Received: from heron.mail.pas.earthlink.net (heron.mail.pas.earthlink.net [207.217.120.189]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1F5D243FA3; Fri, 20 Jun 2003 02:14:39 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from user-uinj93o.dialup.mindspring.com ([165.121.164.120] helo=mindspring.com) by heron.mail.pas.earthlink.net with asmtp (SSLv3:RC4-MD5:128) (Exim 3.33 #1) id 19THyf-0001sm-00; Fri, 20 Jun 2003 02:14:38 -0700 Message-ID: <3EF2CF89.3E5542F5@mindspring.com> Date: Fri, 20 Jun 2003 02:10:33 -0700 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Don Lewis References: <200306200617.h5K6HaM7058935@gw.catspoiler.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-ELNK-Trace: b1a02af9316fbb217a47c185c03b154d40683398e744b8a44034bf79371c0c1e01d27dd4261b1767350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c cc: freebsd-hackers@FreeBSD.org cc: uitm@blackflag.ru Subject: Re: open() and ESTALE error X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jun 2003 09:14:40 -0000 Don Lewis wrote: > > +again: > > error = vn_open(&nd, flags, cmode); > > if (error) { > > + /* > > + * if the underlying filesystem returns ESTALE > > + * we must have used a cached file handle. > > + */ > > + if (error == ESTALE && stale++ == 0) > > + goto again; > > /* > > * release our own reference > > */ [ ... ] > If the name of the file are you attempting to open is relative to your > current working directory, and your current working directory is nuked > on the server, vn_open will return ESTALE, and your patch above will > loop forever. No, actually he thought of that (I read the code this way the first time too, but was lucky enough to read it through a couple of times while looking at the NFS sources in another window, so I caught myself before sending anything). Specifically, see the underline part of: > > + if (error == ESTALE && stale++ == 0) --------------- ...he exits it after retrying it fails, and falls into the standard ESTALE return case. If this gets committed (which I think it shouldn't because I can see a genuinely bad handle getting converted to a good one in a couple of cases), that line should probably be rewritten to be more obvious (e.g. move the "stale++" before the "if" statment and adjust the compare to compensate for the difference so no one else reads it the way we did). Your other comments are good, though (see other post). -- Terry